Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Pivot Point?

This topic is 5378 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

Hi, For instance, if you design an object with the pivot point in the centre, when you rotate it using matrices, it''ll rotate around the pivot point, since all of the vertices positions are relative to the pivot, But what if that object, fir instance is part of a bigger object, then how can we actually calculate the two reotations and the positioning of the object? The only way I can think of, is designing the mesh with the pivot at the centre, then rotating it using the Child rotation, then the Parent rotation, then somehow position it correctly according to the parent position. But thats is "Extremely" hard for me (HS maths) and puts a lot of overhead. The application that I need this for is a laser turret on a spaceship. When the spaceship rotates, the turret rotates with it, but the turret has it''s own secondary rotation for aiming. I think there must be an easier way to do this and if someone would care to explain, I''d be more than happy. -Sorry for the long post

Share this post

Link to post
Share on other sites
Actually, that would be how it is done.

Consider; you have a "RelativeNode" object which does nothing but track its own XYZ position and rotation in its parent container''s frame of reference.

Your universe is a RelativeNode with no parent. Call it an AbsoluteNode.
Your spaceship is a RelativeNode, and the universe is its parent.
Your turret is a RelativeNode, and your spaceship is its parent.

When doing anything with the turret, perform its transformations, then its parents'', then its parents''... until you reach the AbsoluteNode.

In this way, you can have not merely a turret on a spaceship, but you can have a turret on a spaceship docked with a spinning space station orbiting a moon orbiting a planet orbiting a sun. With relatively little added complexity on your behalf.

However, when dealing with the turret alone, it is still sitting upright, in fact, it is the exact same way it was modelled. Then you rotate it around its axis and tilt the turret up; then you take the turret construct, move and rotate it into its position on the ship; then take the ship & turret construct, and move and rotate it into its position relative to whatever it is attached to (which could be "nothing", in which case, relative to the universe "origin")

Hope this helps!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!