Jump to content
  • Advertisement
Sign in to follow this  
LeonPost

Box creation and rotation

This topic is 3784 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am creating a box as six different meshes rather then one mesh. I am creating the box like the follow Side one = (0, 0, 0, width, height) - Front Side one rotation = (0, 0, 0) Side two = (0, 0, 0, depth, height) - Left Side two rotation = (0, -90, 0) Side three = (0, 0, depth, width, height) - Back Side three rotation = (0, 0, 0) Side four = (width, 0, 0, depth, height) - Right Side four rotation = (0, -90, 0) Side five = (0, height, 0 width, depth) - Top Side five rotation = (90, 0, 0) Side six = (0, 0, 0, width, depth) - Bottom Side six rotation = (90, 0, 0). When I render everything without a box rotation, it will render just fine. However, if I render with a box rotation, all the rotations go wrong. When applying a box rotation I do ApplyMatrix = box.matrix * box.sides.matrix Is this the way it should be done or is there anything way?

Share this post


Link to post
Share on other sites
Advertisement
It's a little difficult to tell from what you posted.

However, try:

ApplyMatrix = box.sides.matrix * box.matrix;

instead. (reverse the order of the transform multiplication)

The reason for doing that is that you want to position and rotate the sides of the box first, before you apply additional rotations.

Share this post


Link to post
Share on other sites
Thank you, that is exactly what I was looking for. I have been trying for hours and tried about half a dozen different ways but never tried that one.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!