View Full Version : XPresso - Rotate Vector..
MidnightCow 10-07-2009, 11:15 AM Hi,
Say you have some thinking particles with velocity vector of 0,0,1 and you want to rotate that vector constantly each unit of time say around the y axis - how would i achieve this?
I can get the particles to curve to 90 degrees from the original axis by just adding to the x component of the velocity, but obviously that aint right and would like to rotate freely.. can`t quite get my head around it.
Thanks for any advice.
|
|
mazab
10-07-2009, 11:38 AM
You multiply your vector with a rotation matrix. Rotation Matrices are explained here (http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/index.htm) very well.
Or just use the XPresso Preset for this
X-Pool->System Presets->Matrix->Rotate Vector
Cheers
Björn
MidnightCow
10-07-2009, 03:19 PM
Wicked thanks Srek i knew you`d turn up with the answer.
I would like to know what`s going on in that preset, but it`s coffee script and i aint familiar with the methods.
One thing i noticed though there`s a Matrix2HPB node in xpresso, but i don`t think there`s a reverse - which i think woulda done it!
Thanks again.
mazab
10-07-2009, 03:31 PM
Well, it multiplies the InVector with the InMatrix (like I said above multiply your Vector with a Rotation Matrix). What the preset also does is to internally convert the Rotation (if you give it a Vector Rotation) to a Rotation Matrix.
A HPB2Matrix node is also there in the Presets. X-Pool > SystemPresets > Matrix > Generate Matrix. With this node you can put a Rotation Vector (with HPB components) into a Matrix (plus the Position).
MidnightCow
10-07-2009, 05:21 PM
Thanks dude.
CGTalk Moderation
10-07-2009, 05:21 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.