Projectile Rotation after Orientation
by Vinh Tran · in Torque Game Engine · 08/08/2005 (2:23 pm) · 2 replies
My math skills are a little fuzzy, so I was hoping that someone might point me in the right direction.
In my game I have created a Frisbee Projectile object. I've modified the engine to support real Frisbee physics and my disc travels how I want it to.
At the time of creation, my frisbee has a Forward vector that is equal to the corresponding unit vector for the projectile's initial velocity. This vector never changes during the flight of the disc.
Now, I always want my frisbee to be rendered in such a way that it is oriented to this forward vector. By default, a projectile orients itself based on its current velocity. There is a call to a function in Projectile::interpolateTick() called (writing this from work, function name may not be 100% correct) GetOrientFromDirection(Point3F dir). You pass in a vector and it will create an orientation matrix aligned in the direction of this vector. I've modified this call so the passed in parameter is my forward vector and this creates a perfectly drawn frisbee with perfect orientation. Now comes my problem.
On top of this orientation I need to rotate the frisbee. So my question is, how would I rotate my frisbee projectile and incorporate the orientation?
Note: GetOrientFromDirection(dir) Returns a MatrixF that is oriented based on dir. Its a mathutility function.
In my game I have created a Frisbee Projectile object. I've modified the engine to support real Frisbee physics and my disc travels how I want it to.
At the time of creation, my frisbee has a Forward vector that is equal to the corresponding unit vector for the projectile's initial velocity. This vector never changes during the flight of the disc.
Now, I always want my frisbee to be rendered in such a way that it is oriented to this forward vector. By default, a projectile orients itself based on its current velocity. There is a call to a function in Projectile::interpolateTick() called (writing this from work, function name may not be 100% correct) GetOrientFromDirection(Point3F dir). You pass in a vector and it will create an orientation matrix aligned in the direction of this vector. I've modified this call so the passed in parameter is my forward vector and this creates a perfectly drawn frisbee with perfect orientation. Now comes my problem.
On top of this orientation I need to rotate the frisbee. So my question is, how would I rotate my frisbee projectile and incorporate the orientation?
Note: GetOrientFromDirection(dir) Returns a MatrixF that is oriented based on dir. Its a mathutility function.
Torque 3D Owner Tony Richards