Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am using NavMeshAgent in my Unity project to calculate and move my object to a particular location.

When I do:

navMeshAgent.destination = destinationPt

the object starts moving, but the motion of the object is very jerky.

Is there a way to override the function which is responsible for the jerkiness of the object motion? Or is there a way I can remove the jerkiness of the motion some other way?

I also tried setting

navMeshAgent.updatePosition = false

after which I use

navMeshAgent.CalculatePath(destinationPt, path)

to get the path, but then after this I am not able to figure out how to write my own logic to make the object move. I want a smooth motion with a given acceleration and a max velocity.

share|improve this question
    
If you're using the version of Unity I think you are, I helped with the implementation of some of the navAgent stuff. I can't think of why this would happen due to something in the navigation system. It seems like something else is going wrong. –  Almo Feb 6 '13 at 15:34
    
I am using Unity 4.0.0f7 I have also read on some forum that the problem was there with previous versions of Unity. Is there a way to override the motion of the object while still using the NavMeshAgent. –  Him Feb 7 '13 at 9:04
    
Doesn't the navMeshAgent have settings for acceleration and max velocity? –  Almo Feb 7 '13 at 14:40
    
That's not the problem here. The problem is that the motion of the object is jerky. I have tried setting a lot of acceleration and velocity values but the motion is still jerky. –  Him Feb 8 '13 at 4:37
    
Can you post a youtube vid of it? –  Almo Feb 8 '13 at 14:36
show 2 more comments

1 Answer

Your camera movement is jerky, not the movement of your object.

When updating the camera position it's best to use LateUpdate, this ensures that the update takes place after all of the other Update calls. This means the position of the camera will be accurately positioned for the same frame you're updating. As stated in the documentation:

For example a follow camera should always be implemented in LateUpdate because it tracks objects that might have moved inside Update.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.