- Home /
Transferring velocity from kinematic to a rigid body
I have a rigid body which is set to kinematic (isKinematic = true). It is being kinematically moved around the environment using transform.translate and transform.rotate. However, I need to switch physics on at one point....
The problem is, when I do this, I need to apply the same velocities to the object that it was under when it was kinematic. Is there a simple way to calculate this?
I know that I can store the position at each time-step and use this to calculate the forward velocity at changeover, but I would rather avoid that as there are quite a few bodies I would need to do this for. Im also unsure how I would calculate the angular velocity...
Is there a way to capture the velocoty (and angular velocity) of an object while it is in kinematic mode?
Thanks.
What you suggest, calculating the forward velocity and angular velocity, are the only options I'm aware of. Probably not what you want to hear, but just giving you a data point :P.
If you calculate the velocity, you should be able to use rigidbody.AddForce with Force$$anonymous$$ode set to VelocityChange.
Hmm, if I knew for sure, I'd provide an answer below, but here's my best shot:
For regular velocity, you just need to know the direction of movement and the speed of the object (units/second). Velocity = Displacement / Time. How are you moving the object kinematically? You might be using the velocity anyway.
For angular velocity, you'd need to deter$$anonymous$$e the speed at which the object is rotating (degrees/second or radians/second). If you're already rotating the object kinematically, I think it would be pretty straightforward to deter$$anonymous$$e the rotation speed? For example, if you are rotating by rotSpeed * Time.deltaTime in kinematic mode, then I think you can just use rotSpeed?
Your answer
Follow this Question
Related Questions
Strange/Buggy code behavier 1 Answer
isKinematic object doesnt collide with wall 3 Answers
Move a rigidbody when Kinematic ?? 3 Answers
Velocity for movement 0 Answers
Pausing and Resuming a Rigidbody 1 Answer