- Home /
GameObjects not moving smoothly when camera is also moving
I am trying to create a mini quad (drone) first person view game. In a nutshell the player controls the camera by using a remote control used to fly real drones. After adding a few other object to the scene that also move or rotate i started seeing that when the camera is moving the object seem to jerk from position to position. This is for moving and rotating. When the camera is stationary it seem fine.
Here is the code that moves the bulldozer (on the Update). There is also a bit that rotates it towards the next waypoint.
transform.position += transform.forward * speed * Time.deltaTime;
The camera is moved in the fixedUpdate :
float force = throttle * motorOutput * 4;
rb.AddForce(transform.up * force);
rb.angularVelocity = transform.TransformDirection(new Vector3(p * degP * Time.deltaTime, y * degY * Time.deltaTime, r * degR * Time.deltaTime));
All I can think is that the time difference between fixed update and update is a problem.
Any Ideas ?
Answer by Lost_Syndicate · Jan 22, 2018 at 04:42 PM
Yes, try fixed update. Maybe try decreasing the force?
The force applied is just enough to overcome gravity. So at a hover the force up cancels out gravity.
Physics equations as far as I understand need to go into FixedUpdate and not Update. I will place the movement of the bulldozer in FixedUpdate too and see what happens. I am not sure if that is good practice though.
Answer by NoobGaming · Jan 22, 2018 at 06:15 PM
Try using LateUpdate() instead of FixedUpdate(). Works nice for camera movements.
Your answer
Follow this Question
Related Questions
Locating Position of Object not Working? 2 Answers
Smooth Position Change (Ironsights) 1 Answer
[Solved] How to get non repeating random positions? 5 Answers
Need insight on strange (simple) 2D object transform bug 0 Answers
Creating instance of GameObject(Holding component) at same location as object that holds the script 1 Answer