Raydium 3D Game Enginehttp://memak.raydium.org/ Relative pos/rot same as vector multiplication?http://memak.raydium.org/viewtopic.php?f=8&t=899 Page 1 of 1

 Author: vicentecarro [ Tue Oct 28, 2008 10:32 pm ] Post subject: Relative pos/rot same as vector multiplication? I need to get the world position/rotation of a vector accoding another vector.This is the same than multiply the two vectors? If so, how can I do that multiplication?

 Author: Xfennec [ Wed Oct 29, 2008 8:31 pm ] Post subject: Re: Relative pos/rot same as vector multiplication? Not sure to understand what you mean by "according another vector" ... ?

 Author: vicentecarro [ Wed Oct 29, 2008 11:02 pm ] Post subject: Re: Relative pos/rot same as vector multiplication? Ok, long explanation:The cal3D models have position(3 float) and rotation(3 float) as ODE elements.Inside a cal3D model, with a cal3D function, I can get the position(3 float) and rotation (1 quaternion) for a certain bone X at a certain time.But the values of the bone are relative to the model.I need to get the world values, not relative, so i guess I have to multiply the initial vector(of the model) by the pos+quaternion of the bone.It's that correct? If so, How can i do that?

 Author: Xfennec [ Thu Oct 30, 2008 8:33 pm ] Post subject: Re: Relative pos/rot same as vector multiplication? Well well well ... any math skill here ? Someone ? Author: ouille [ Sat Nov 01, 2008 5:22 pm ] Post subject: Re: Relative pos/rot same as vector multiplication? Hello,You have: ModelPosA as 3 float, and EModelRotA as 3 float wich are absolut.You have: BonePosR as 3 float and QBoneRotR as 1 quaternion wich are relative to the Model.You need BonePosA and BoneRotA wich are absolut (world) pos and rot of your bone.Hope i'm right.I don't easly deal with quaternion, it's probably bad, but ...Use ode dQtoR to convert your quaternion to a rotation matrix.You will have BoneRotR as rotation matrix.You can use ode dRFromEulerAngles to get ModelRotA as Rotation Matrix form 3 float wich are euler angles.At this time:Orientation of your bone is the multiplication of both rotation matrix:BoneRotA = BoneRotR * ModelRotA // Be carrefull order is important from my memory this is the right order but i may be wrong BonePosA = ModelPosA + ModeRotA * BonePosR // You will have Bone Absolut positionOde dGetEulerAngleFromRot return euler angle (as 3 float) from your BoneRotA for example.It's probably better to make some tests using Maxima or an other math program.Secondly:Quaternion seem's to do the same thing as rotation matrix.So it's probably more efficient to get quaternion of your model and multiply your quaternion (absolut and local) than using rotation matrix.Have a nice dayOuille.