Syncing box rotation with the model
Posted: Sat Sep 24, 2011 4:40 am
So I'm drawing some cubes to match up with some box prefabs, and I'm getting some strange results. See the screenshot:
http://screencast.com/t/APEwqVEYQE
As you can see when the boxes are upright, the model is oriented correctly, but the cubes on the floor have been rotated and while I know the box body is aligned correctly the cube model clearly is not. This leads me to think it is an issue with the origin of the rotation, but I can't seem to figure out where the issue could be coming from. Thanks for your time! The engine seems really great so far, I love working with it.
Here's my code for updating the position and rotation of the model to match the box, I figured it was straightforward enough.
http://screencast.com/t/APEwqVEYQE
As you can see when the boxes are upright, the model is oriented correctly, but the cubes on the floor have been rotated and while I know the box body is aligned correctly the cube model clearly is not. This leads me to think it is an issue with the origin of the rotation, but I can't seem to figure out where the issue could be coming from. Thanks for your time! The engine seems really great so far, I love working with it.
Here's my code for updating the position and rotation of the model to match the box, I figured it was straightforward enough.
Code: Select all
public void Update()
{
CModel.Position = physBox.Position;
CModel.Rotation = physBox.Orientation;
}