That's how you are supposed to feel working with quaternionsOriginally Posted by NecroDOME
That's how you are supposed to feel working with quaternionsOriginally Posted by NecroDOME
Peregrinus, expectavi pedes meos in cymbalis
Nullus norvegicorum sole urinat
Ill post a screenshot soon of what I have made...
NecroSOFT - End of line -
1 final question:
How can I rotate a point (vector).
Need it to apply correct forces to fly forward with my helicopter (and to rotate te rotor on top)
NecroSOFT - End of line -
UPDATE: I think I got it working...
I still need to know how to rotate a point. I want my helicopter to fly forward (or backward), but can it be done with the quaternions? it's flys up in the correct direction. But if I rotate the helicopter 90 degrees, how can I make it fly forward? it only pitches on the Z axis (local space) but need to transform the movement to global space.
Screenshots I promised:
3D max rendering
I need to make the inside of the helicopter and some weapons + skinning...
NecroSOFT - End of line -
I am not sure if i understand well what you want, but if you mean how to rotate your helicopter and move forward to the new direction it is now pointing then it is the same method used for any first person shooters.
* You have a "position" point where you store your current hellicopter position.
* You have a "forward" unit vector like 0,0,1 (if forward mean moving torward the positive Z), every time you add the forward vector to the position your hellicopter move forward one unit.
* you store your current rotations for planes x,y,z like rx,ry,rz. you setup your keyboard for increment/decrement Rx,RY,RZ.
Every time you update your hellicopter new position, you rotate your hellicopter model by rx,ry,rz, using as origin the last position, that will makes your hellicopter head to the desired direction. Then you copy the "forward" vector and you rotate that copy by Rx,Ry,RZ (using as origin always 0,0,0); then you just add this new resulting vector to the last position point for get the new hellicopter position.
You can have more directions vectors like backward, slide_left, slide_right when rotated a copy of them by your acumulated rx,ry,rx then that copy will always point to the relative hellicopter direcion.
hope that help
I managed to make it fly forward, backward etc, but I can't get the main rotor in place. The position is correct, but the rotation is a little messed up.
NecroSOFT - End of line -
Anyone?
NecroSOFT - End of line -
It is your main rotor a different mesh?, if so be sure it's bind pose is located at (0,0,0).
your rotor normally will be rotated using the Y plane (if Y mean Up in your engine), but when you rotate the whole hellicopter let's say about Z plane then the rotor is rotated in Y and in Z; so it is important to note the Order used for rotate things, you will not get the same result if you rotate first by Z then by Y than doing Y first then Z. that is why i have procedures like Quaternion_Rotation_XYZ and Quaternion_Rotation_YXZ, etc.
This is taken from FastGeo.
These routines rotate a 3D point around another 3D point (origin).
FastGeo provides many useful calculations for 2D and 3D (so maybe other problems can be solved using it, too).
Hope this helps.Code:interface procedure Rotate(const Rx,Ry,Rz:TFloat; const x,y,z:TFloat; out Nx,Ny,Nz:TFloat); overload; procedure Rotate(const Rx,Ry,Rz:TFloat; const x,y,z,ox,oy,oz:TFloat; out Nx,Ny,Nz:TFloat); overload; function Rotate(const Rx,Ry,Rz:TFloat; const Point:TPoint3D):TPoint3D; overload; function Rotate(const Rx,Ry,Rz:TFloat; const Point,OPoint:TPoint3D):TPoint3D; overload; implementation ///////////Rotation around axis origin (0,0,0) procedure Rotate(const Rx,Ry,Rz:TFloat; const x,y,z:TFloat; out Nx,Ny,Nz:TFloat); var TempX : TFloat; TempY : TFloat; TempZ : TFloat; SinX : TFloat; SinY : TFloat; SinZ : TFloat; CosX : TFloat; CosY : TFloat; CosZ : TFloat; XRadAng : TFloat; YRadAng : TFloat; ZRadAng : TFloat; begin XRadAng := Rx * PIDiv180; YRadAng := Ry * PIDiv180; ZRadAng := Rz * PIDiv180; SinX := Sin(XRadAng); SinY := Sin(YRadAng); SinZ := Sin(ZRadAng); CosX := Cos(XRadAng); CosY := Cos(YRadAng); CosZ := Cos(ZRadAng); Tempy := y * CosY - z * SinY; Tempz := y * SinY + z * CosY; Tempx := x * CosX - Tempz * SinX; Nz := x * SinX + Tempz * CosX; Nx := Tempx * CosZ - TempY * SinZ; Ny := Tempx * SinZ + TempY * CosZ; end; (* End of Rotate 3D Point *) ///////////Rotation around 3D point (x,y,z) -> This may be what you need procedure Rotate(const Rx,Ry,Rz:TFloat; const x,y,z,ox,oy,oz:TFloat; out Nx,Ny,Nz:TFloat); begin Rotate(Rx,Ry,Rz,x - ox,y - oy,z - oz,Nx,Ny,Nz); Nx := Nx + ox; Ny := Ny + oy; Nz := Nz + oz; end; (* End of Rotate 3D Point About Origin Point *) ///////////Just other declarations with TPoint3D types function Rotate(const Rx,Ry,Rz:TFloat; const Point:TPoint3D):TPoint3D; begin Rotate(Rx,Ry,Rz,Point.x,Point.y,Point.z,Result.x,Result.y,Result.z); end; (* End of Rotate 3D Point *) function Rotate(const Rx,Ry,Rz:TFloat; const Point,OPoint:TPoint3D):TPoint3D; begin Rotate(Rx,Ry,Rz,Point.x,Point.y,Point.z,OPoint.x,OPoint.y,OPoint.z,Result.x,Result.y,Result.z); end; (* End of Rotate 3D Point About Origin Point *)
Greetings,
Dirk
<a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>
Bookmarks