0

I will start by apologizing I highly doubt I will have any of the correct terminology, unfortenately after a few hours of raw testing and mashing my head against the wall I can figure this out.

I working with an engine the orients its models using a bottom aligned system. Meaning that the z axis (in a z up system), is z - radius = origin, or if the model is sitting at 0,0,0 all the tris would be in positive-z space.

I am integrating bullet which is a center aligned system, meaning that the objects origin is in the center of the mass (in this case a simple aabb cube).

I have the problem that the yaw pitch roll and origin i pass into the renderer is offset by radius in the z+ direction. Now the biggest issue comes when the pitch or roll becomes something other than 0. Because bullet's center aligned system, rotates around the pitch and roll around the center and the render rotates around the bottom. So there is a clear difference in where the model and the bounding box are lining up.

So is there an algorithm to convert from these two forms of orientation?

  • I thinks this question has the potential of being interesting, but for me it would be much clearer if you'd illustrate with a short piece of code showing a concrete example. – Christophe Mar 14 '15 at 10:10
  • hard to illistrate in code i can show you some pictures it would be much clearer. [link](http://imgur.com/a/0iqm1#0) the orange box is blenders aabb, the cube is the engines model render and the fireball particle is the center origin. As you can see the model renders from the bottom of the origin. So basically i need an algorithm that makes the boxes line up :) the box width height and depth is 4.0. – user1721320 Mar 14 '15 at 10:49

1 Answers1

1

OK I figured out my own issue.

So For any one that stumbles upon this ill explain what exactly is happening and how to fix it.

Simply put my question is how to convert from world space (x, y, z planes) to local space (relative x y z planes). So if you were to take an arrow and face it in the direction of 0 x 0 y 0 z, where as its origin was in positive space, say 1 x 0 y 0 z your arrow is facing in world space. Meaning that if you were to move forward you would be moving along the x plane, left along the y plane, and up along the z plane.

Now if that arrow rotated along the yaw x degrees so that it was pointing at 1 x 1 y 0 z now when you move forward you are no longer moving along just the x plane. So this is whats called moving in local space. Meaning you are moving along the planes that are relative to the yaw and pitch of your node (object, model, etc).

So in my case i have bullet which is working in "world space" and i have my render that is working in "model space" so i just need to put it in a matrix that converts the two.

Two convert the spaces I need a projection matrix that converts them.

So here's the link to the source that I found that converts this and explains the relative math fairly easily. http://www.codinglabs.net/article_world_view_projection_matrix.aspx

thanx every one chasester

  • Might I suggest that you move the clarifiction of your question that you have put in your answer up to the actual question? Just for the sake of good form and being easier for people googling the issue to identify if this question is likely to help them or not. – Benjamin James Drury Mar 22 '15 at 00:54