- Home /
Rigidbody Turning
I'm making a semi-deterministic game that relies on Unity's RigidBody. The game consists of flying a spaceship top-down RTS-style and the ship needs to have acceleration for turning and also a limit for the turn speed. Because it's top-down, I only need to turn the Y-axis of the ship and the point to turn towards will always be on the same x-z plane as the ship.
How do I accomplish this turning using a RigidBody? Note: I'd rather directly change the AngularVelocity instead of adding torque so I can keep the game as deterministic as possible and make syncing clients easier.
Answer by jpthek9 · Jan 04, 2015 at 05:08 AM
WAHOOO!! Best feeling in the world to figure something out! So it's actually a pseudo solution and it'll probably be more of a hassle on the networking side but it works. Now I'm using Unity's pathfinding solution on a flat quad. It features collision detection as well as what I need for acceleration and turning.
Answer by EvilTak · Jan 03, 2015 at 06:45 PM
You can also use Rigidbody.MoveRotation. This way you can use Quaternion.Euler to return a rotation along the y axis and make the rigidbody rotate to that quaternion. This is very deterministic so you won't have a problen syncing clients.
O $$anonymous$$ G this is EXACTLY what I needed! I just spent a long time searching and couldn't come up with anything. $$anonymous$$any thanks :)
I want to open up this question again. I tried Rigidbody.$$anonymous$$oveRotation but unfortunately it doesn't work with rigidbody interpolation. Sorry I didn't mention that before. Are there any other alternatives? Why can't I modify Rigidbody.angularVelocity directly like I can Rigidbody.velocity?
Your answer
Follow this Question
Related Questions
Can you add a force to a rigidbody at an angle? 3 Answers
Bullet rifling simulation 1 Answer
Velocity based on rotation 1 Answer