Jump to content

Transforming Velocity or Direction vector

Recommended Posts

If I want to transform a velocity vector by a matrix4, do I just multiply it by the transpose(inverse(matrix4))?

maybe I need to extract the scale from the matrix and multiply the velocity by that as well?


Cross posting from https://www.sidefx.com/forum/topic/45863/ in case more people will see it here

Share this post

Link to post
Share on other sites


I think you can just turn the velocity into a float4, make sure the last component is zero, and then multiply it by the matrix. (As it says here in the docs). However I'm not a master at matrix math so I might be missing something.

edit: re-read the help doc I linked and it said that when transforming a normal you want to multiply it by the inverted transpose of the matrix. but it seems like a velocity would just be transformed as a regular vector. However It would be interesting to know why you do one thing with a vector and another with a normal.

edit2: Looks like you use the inverted transpose so that the normals will stay perpendicular to the surface. (as explained here).

edit3: I did a test and I'm pretty sure that for a velocity vector you want to use the vector rules and not the normal rules.

Edited by MirrorSword
  • Like 2

Share this post

Link to post
Share on other sites

Thanks James!


Finally had a chance to test it and that does seem to be what I'm after.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now