Jump to content
  • Advertisement
Sign in to follow this  

rotate around a point using matricies

This topic is 4700 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 don't know why this doesn't work properly
// Gets the center of the entire object
		GetTileCenter(&point, lvl_width/2, lvl_height/2);
// Move its center to be center of origin
		p.Translate(-point.x, -point.y, -point.z );
// rotate where level_select_rotate is angle in radians
		p.Rotate(level_select_rotate, 0, 1, 0);
// I want it to stay in the center however I want to move it down a few units
		p.Translate(0, -5.0, 0); 
// Load matrix to OpenGL
// draw object	

It does not seem to work. It rotates around a point of (0, 0, 0) of the objects coordinate system. What Iam trying to do is have a "preview of the level" rotating in the center of the screen. The level data starts at (0, 0, 0) and extends in the +x, +y, -z quadrant. Thank you!

Share this post

Link to post
Share on other sites
After the rotation, translate back by +(point.x, point.y, point.z) (plus any additional translation you want). Beyond that, I would need a clearer description (pictures would help) of what's happening vs. what you want.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!