Hi, Im not sure why im finding this so difficult but I am for some reason.
I have a moving body which can go in all directions and I am trying to find the velocity in the X direction of a POINT on that object.
I can find the X Velocity of the rigid body by simply doing the following:
I am assuming that you are trying to get the point velocity relative to transform.left of the rigidbody.
I look at your code and I cannot see what is going wrong . If local to world space transforms, coordinate systems, the meaning of .x in local space, confuse you, and have unexpected results, you are by no means alone – I have the same problem and I’m no girl next door.
This is why I generally discourage using .x, .y, .z components if at all possible – there’s no reason to make yourself dependent on a coordinate system when we have vectors and quaternions. There’s a simple and slick way of doing this that will give you the point velocity no matter what.
My suggestion (not tested) is to start by trying this:
If the code is doing what you think it is doing, this should give you exactly the same answer as getting the .x component. In that case, I suggest taking a close look at your object’s behavior – maybe that makes sense.
However, I have a hunch it’s not doing what you think it’s doing, and I’ve run into problems with using components in unity before, which is why I stopped.