Game Development Community

Rotating mounted objects

by Samuel Cartwright · in Torque Game Builder · 04/25/2009 (1:50 am) · 4 replies

I have one object mounted to another.
I want the mounted object to rotate around the object it is mounted to, but I want both objects to keep their original orientation - ie, the sprite images don't rotate, but one object will move around the other.

At the moment I'm mounting one object to the other, and calling rotateTo on the parent. But I don't actually want both objects to rotate, I just want one to move around the other.

Perhaps I'm not using the right function, but I thought this might be the easiest way to get one object to move around another.

Can anyone give me some guidance?

Thanks,
Sam.

#1
04/25/2009 (2:25 am)
So what you're saying is that you want one object to orbit the other, with one staying on a regular path?

I'm no good at this, and can't give an answer directly, but it involves some math (degrees and/or radians). The orbiting object needs to keep a fixed distance from the main object, positioned at a variable point in a circle around it. I think rotateTo() will just treat both objects as an entity, so you need different calculations for each.
#2
04/25/2009 (2:32 am)
This thread could be helpful.
#3
04/25/2009 (2:43 am)
@Ronny, Thats exactly what I wanted - I thought there might be an easy way without all the math.

@Stefan, Thanks for the link - I'm working my way through it now.

Cheers,
Sam
#4
04/25/2009 (6:59 am)
Thanks, Stefan. That goes into the vast collection of snippets :)