Models and axis alignment

Blitz3D Forums/Blitz3D Beginners Area/Models and axis alignment

Gazza69(Posted 2013) [#1]
What is the "standard" orientation of an object - I know it can vary, but is it better to try and be consistent and have an object face in the z direction , that way you know that know that forward and rotational movement is always going to be the same for all objects ?

Which brings me to question 2. If an object is not aligned in this way - lets say its aligned along the x axis, well then, can I translate its axes so that it is aligned to z ? Currently , when I find an object like this, I orient it the way I want it to be, and then attach it to a pivot so that it moves foward "correctly" using moveentity myship_pivot,0,0,1.

I've recently discovered pre made 3ds studio models are a lot less of a headache than to manually try and build things using mesh and primitives


RemiD(Posted 2013) [#2]
It depends on what you want to do with the pivot/mesh.

Most of the time i put the origine of a mesh at the bottom center of the mesh, or at the center of the mesh. The mesh Front must face the +Z direction so that when i use TurnEntity()/MoveEntity() i know where it will Turn/Move.

Edit : If you are going to use Blitz3d commands like TurnEntity() MoveEntity(), it will make things easier to rotate your mesh so that its front faces the +Z direction. In Blitz3d -Z is backward, +Z is forward, -X is left, +X is right, -Y is down, +Y is up.

But sometimes i need to put the origine of the mesh at another position, for example if i want to add an openable door, the origine will be where the hinge has to be, so that when i rotate the origine, it rotates the hinge and the door moves, the door does not rotate around its center. You can also do the same thing by using another pivot, i know.

A simple way to check where is the origine of your mesh is to create a debug marker.

Origine = CreateCube()
ScaleMesh(Origine,0.01/2,0.01/2,0.01/2)
EntityColor(Origine,255,000,000)
EntiryFX(Origine,1)


Then you can see if the mesh is scaled/oriented/positioned correctly or if you need to modify something.

You can modify the mesh scale/orientation/position in your modeling software or with the commands ScaleMesh() RotateMesh() PositionMesh().
Please note that these commands will mess up a rigged/skinned/animated mesh.

For an animated mesh you can use the technique you describe, that is creating a pivot and making the animated mesh child of the pivot. And then you can use ScaleEntity() RotateEntity() PositionEntity() to set the correct scale orientation position.

Last edited 2013

Last edited 2013


GfK(Posted 2013) [#3]
Yes, moving an object along it's Z-axis should move it forward/backward.

If memory serves (and I haven't used BB3D for probably six or seven years now), .X format models work in the same way to .3DS, but they're inverted on one of the axes (x, I think). You need to use LoaderMatrix() to get them to load correctly.

Either way, as a rule, Z is always forward/back though as this leaves X and Y in correlation to the screen orientation (i.e. across and up/down).

[edit] Bit drunk, may not make sense.

Last edited 2013


Gazza69(Posted 2013) [#4]
Great replies guys, clears up a few things.
Thanks.
Just curious GFK, what made you move away from Blitz3d ?