Right now in my project, I am calculating + incrementing a movement Vector in Update and moving my player, projectiles and all enemies in FixedUpdate. The problem is that with the FixedUpdate being 30fps, movement is very much stuttering and not smooth at all. I could move all movement to Update, but I thought it’s bad for collision detection & my game could be exploited by having a low framerate. What do you think?
FixedUpdate() is only intended for use when using Physics / Physics2D.
With Physics (or Physics2D), never manipulate the Transform directly. If you manipulate the Transform directly, you are bypassing the physics system and you can reasonably expect glitching and missed collisions and other physics mayhem.
Always use the .MovePosition() and .MoveRotation() methods on the Rigidbody (or Rigidbody2D) instance in order to move or rotate things. Doing this keeps the physics system informed about what is going on.
With a wheel collider, use the motor or brake torque to effect motion.
The thing is, I don’t need 3D Physics in my game. I only use Kitematic Rigidbodies in order to enable collision detection. Is there better way to do this and do I still bypass the collision system by doing that?
Is there a difference between using .MovePosition() and .MoveRotation() and setting the position via transform.position or transform.Translate() when I do not even use the Physics system / use it only for collision detection?
Anybody has an answer here?
Yes there is. If it has a rigidbody and you want physics to work - even if it’s kinematic - you should be moving it through the rigidbody API. Otherwise, if you translate it normally it will not impart physics on objects touching it.
Also make sure you set your rigidbody’s “Interpolation” setting to interpolate so the visuals side are smoothed out.
Also, the .MovePosition will move the physics model immediately but only update the Transform a bit later. If you’re NOT using Physics at all, best to just use the Transform directly.