Moving Kinematic Rigidbody2D velocity

Hi,

like the topic says, seems like I’m unable to get velocity of moving Rigidbody2D that is set as kinematic, animated by either Animator or Script that moves object in FixedUpdate.

Someobject.GetComponent().velocity only returns Vector2 value that is zero.

Should I even be doing this? Or should I just calculate velocity from previous and current position. I think I’ve seen some tutorial where velocity was used, however can’t find any answers using search engines.

Info: I’d use this velocity to modify object’s velocity on platform and such.

Any help appreciated!

I dont think kinematic rigidbodies can have velocities.

Like HiddenMonk said. I’m pretty sure that if a rigidbody is kinematic, physics wont effect it in any way, meaning it will never have any velocity. This thread looks useful for getting the ‘velocity’ of a non-physics object - Getting the speed of a gameobject - Questions & Answers - Unity Discussions

Thanks guys - I went to bed and couldn’t answer, but I already got this fixed.

HiddenMonk: I don’t know what I had wrong initially using rb.velocity , but setting rb.velocity seems to actually be working, doesn’t matter if set as kinematic or not.

Now, by setting velocity I still see the velocity of object and can use that.

Osirius: I found that same message, that’s why I mentioned calculating velocity - I’d rather use animation to move object, as ramping speed up/down when stopping becomes too complicated - I’ve got no direct answer how to do this. With animation it’s easy to control.