Unity, how to make NavMesh Agents climb obstacles from any point around it? - unity3d

So I'm working on a game where I want my AI to be able to smoothly climb obstacles from any point around the obstacle but I'm having a hard time trying to figure out how to do this. I know I can use off mesh links to have enemies go on to obstacles but the problem is that they all funnel from a single point and it looks very unnatural. Now I could make a bunch of off mesh links for each obstacle, but I have a lot of obstacles I want to be climbable and that's not very efficient.
Is there a good way to go about this that I can make all of my AI climb at any point around an obstacle? I'm currently using A* Pathfinding but this is kind of a must for my game so any ideas regardless of if A* can do it are welcome.

Related

Unity ball friction either too much or not enough

So i am making a simple Golf game, when trying to replicate the balls movement i have noticed that on slopes the ball functions very oddly, it either never stops or stops too quickly and when travelling down slopes will reach a very slow terminal velocity quickly (ie it stops accelerating down slopes). So it either doesnt deaccelerate enough going up a slope or accelerates too slowly going down a slope.
I have been messing about with angular and static Friction of both the ball and the surface to see if that changes it at all and i have also been changing the friction combine of the surface and the ball to see if that makes any difference and so far haven't had any luck.
Is this a common issue with Unity because i haven't been able to find any other questions about it on here. If anyone could give me some advice on how to have my ball not roll forever but still accelerate when going down a slope that would be great
EDIT: The ball has a rigidbody with continous collision, then the course uses a mesh collider. Both however have attached physics materials
The ball is currently just a basic sphere from unity using a sphere collider, i havent tried changing the rigidbody about much yet other than mass. When the ball is hit i addforce to it, the slopes are an asset i have purchased that are perfectly smooth.
Rolling object physics are indeed difficult in game engines.
As I mention in the comment for such questions it's necessary to know (a) what sort of collider and (b) what sort of object it is, since there are at least 4 major approaches to this problem.
But in general you usually have to manually add the "slowing down" function, in a sense representing air resistance.
For a moment set aside the collider choices, and imagine in the abstract you have a ball rolling along a flat plane. You've somehow started it moving at 2 m/s say.
There's really no reason at all it will stop rolling or slow down. Why would it? There's no air resistance in physX and what you "want" it to do in the game engine physics is keep rolling.
Thus what you do is add a script that, essentially, "slows it down a little" every frame. In pseudocode, something like
velocity = 0.99 * velocity
Note however that alternately, to "manually slow it down", you may have to simply add force to it.
The trick is you do that in the opposite direction to movement
yourBalls.addForce( v.normalized * -1 * some small force )
(It's easy to think of that as basically "air resistance")
You usually also, simply, just add a top speed. In this way on downslopes it won't just get "infinitely fast"
if (v.magnitude > 3.0) v = v.normalized * 3.0
That's basically how you make objects roll around on hilly surfaces.
Note that you basically should not fool with the friction settings in anyway, it's really not relevant in most cases.
Unfortunately there is a vast amount of detail but, I feel your question is more asking for the "basic principles" - and there they are!
Tip: it could be this question is more suited to the gameDev site, where "techniques" of game physics are QA'd.

Unity 3d - Explosion Area Damage

I've developed an airplane 3D shooter game. In this game, I want to make my plane shot a bomb. When the bomb gets to the enemies it will explode and give damage in the area of explosion.
I have already searched for a tutorial to make this code and the animation of explosion. But I couldn't find it. Please tell me about something that could solve this problem. I'm developing my game using C#.
For the explosion animation, you could use a particle system. There are many pre-made ones in the Asset Store, such as this one: https://www.assetstore.unity3d.com/en/#!/content/42285
For detecting what is affected in the explosion's area of effect, do a SphereCast (https://docs.unity3d.com/ScriptReference/Physics.SphereCast.html) from the point of impact and then do whatever you want with any of the objects touched by the sphere.

Path finding on a 2d plataformer game. Making enemies jump

I am working 2D Platform running game and I am stuck at this issue, i cant figure it out how to make my enemies jump through platforms as they follow the player. I used A* path finding with a Grid graph for my flying enemy and it works just fine. But with the ground troops i don't know what to do. Any recommendations where to start and what to study? Thanks in advance
Place a Trigger (Collider) attached with the Platform at the point where you want your enemy to Act (Jump in your case). and Attach a script to your Enemy to Handle its actions whenever it enters that trigger. you can make it Jump/Fly or whatever you want to. Thumb up if its helpful :)

How to change the shooting accuracy?

I am making an FPS game using unity 3d, I've a problem in the shooting accuracy script. Can you tell me how I can change it with a single script that shoot the bullet and include the shooting accuracy and equipped to the gun, please?
If you are currently using a raycast, you should have no problem.
If you are spawning a sphere and thrusting it forwards, I suggest you use a raycast.
Raycasts go in a completely straight line. Bullets follow gravity, and quickly fall to the ground.
You don't see bullets, they move too fast. Raycasts are invisible.
When it hits something, it sends you back the information you need. If you make the sphere go too fast, it might glitch through objects.
You can learn about raycasts here.

Can A* Pathing in AndEngine allow a sprite to determine "incorrect" paths and make "random" choices?

I am currently developing a Tower Defense game for the Android platform using the AndEngine. My enemies (animated sprite extended class) have hard coded pathing. I'd like to switch to something better where the enemies can determine for themselves where to go. I am using TMX maps. Please refer to the following map:
The 2 hexagonal tiles are spawn locations for the enemies. I have 2 questions abou A* Pathing.
At point A is it possible to make sure the enemy doesn't turn down the path towards the other spawn location?
From what I've been told A* Pathing looks for shortest distance, so is there a way to have the enemy randomly select which way to go at point B?
If A* Pathing is sufficient for these test cases, can you supply me a link to a tutorial/example? I haven't found much help through Google.
If A* Pathing can't do this, what are my other options?
In order to use A*, you need to know where the enemy is trying to get to. If you randomize the target locations of the enemies between the two exit points at the right, they should work correctly.