Rotations?

Blitz3D Forums/Blitz3D Beginners Area/Rotations?

Clarks(Posted 2004) [#1]
How can i rotate a mesh using fixed angles in body coordinates? I dont think theres a command for that?


jfk EO-11110(Posted 2004) [#2]
fixed angles in body coordinates? I don't understand that.

You can use RotateEntity to rotate a mesh to a desired angle. This way it will rotate them absolutely. Using RotateEntity mesh,0,0,0 will always turn it back to the initial angle.

You can use TurnEntity, this will turn the Mesh relatively, but. RotateEntity mesh,0,0,0 will always turn it back to the initial angle.


If you use RotateMesh, it will rotate it relatively, and permanently. RotateEntity mesh,0,0,0 will NOT turn it back to the initial angle.

There is always the local/global flag with these Commands, so when your Mesh is a Child of something, you can decide if it should be rotated relatively to its parent or relative to the world.

If you mean you want to determine an angle by a coodinate that is outside the center of the mesh and you want the mesh to point to the coordinate you can eighter set a helper pivot to that coodinate and point the Mesh to it, or you can use Atan2 to calculate the angle.

yaw=atan2(entityx(mesh)-coordinate_x,entityz(mesh)-coordinate_z)

Sorry if I misunderstood your question.


StOrM3(Posted 2004) [#3]
I think, he wants to rotate a mesh, based on a point in the center of the entity. Probably what I am needing also, a way to make a model rotate 90 degrees depending like if my model is on the bottom of a series of objects make it point up, etc.. depending but each rotation should be an exact 90 degree rotation, I am having a problem with an object that is parented to a pivot, even when I use rotateentity, it will not rotate, but will only face the pivot that it is parented to.


Clarks(Posted 2004) [#4]
What i mean is, rotating a mesh using fixed angles in body coordinates as an airplane would rotate.


jfk EO-11110(Posted 2004) [#5]
I still don't understand "fixed angles in body coordinates", my english isn't very good.

As an airplane would rotate? You could create a helper pivot in the center and make it the parent of the airplane. then you simply have to rotate the pivot to make that airplane rotate.


Clarks(Posted 2004) [#6]
Hmmm creating a pivot in the center of the airplane seems like it would work but anyway. Angles in body coordinates simply means that an airplane would pitch in the line direction of its nose and tail no matter where its nose and tail are pointing. It would rolll in the line direction of both wings no matter where they are pointing.
Ok "jfk" you said your english isnt very good, if you still dont understand i can try to be more clear.


Matty(Posted 2004) [#7]
Simply using turn entity will achieve this.

For example if you wish the plane to dive then use turnentity myplane,Pitch,0,0

if you wish it to roll then
turnentity myplane,0,0,roll

where pitch and roll are angles.


Clarks(Posted 2004) [#8]
Matty thanks. Thats what i figured out i would have to do and it worked. It was just a way of getting around the way i wanted to do it.


Ross C(Posted 2004) [#9]
Watch out with turnentity tho. Your best not to use turnentity at all. Rotates things funny. Try this instead:

RotateEntity myplane,EntityPitch(myplane),EntityYaw(myplane),EntityRoll(myplane)+roll


The reason is, if you do turnentity to roll the plane, then try and turn it on the Y axis, it will rotate the plane, along the tilted Y axis, created by the turnentity.

Since Rotateentity always rotates from the same point, it is a better rotation :)


Clarks(Posted 2004) [#10]
Hmmm that makes alot of sense. I will experiment with all possible solutions. Thanks Ross C.


Rottbott(Posted 2004) [#11]
Ross C, that can be fixed by playing with the Global flag. Sometimes you need to do TurnEntity with the Global flag for one angle (say pitch), and without it for another (yaw).