Game Development Community

Rotation around pivot point

by Mohamed ElShami · in Torque Game Builder · 12/01/2008 (11:39 pm) · 4 replies

Hi All,

This might be obvious but I couldn't find the solution in the TGB documentation. How can I rotate SceneObject or apply angular velocity around pivot point instead of the center?

Thanks

#1
12/02/2008 (1:41 am)
Currently there is no direct method allowing you to do this. The only way that I have done it is via a script method physically moving the scene object, or using a mounted scene object as a pivot.
#2
12/02/2008 (1:57 am)
Isn't there a mount point offset?
#3
12/02/2008 (2:06 am)
Thanks Philip, I wanted to use the TGB physics like setAngularVelocity(). When the object is mounted you can't apply physics to it. But looks like my only option is via script as you suggested.

Brian, true there is mount point offset. But again I won't be able to apply forces on the mounted object.
#4
12/02/2008 (4:42 am)
If your sprites are small enough, and depending on where you want the pivot point to be, another alternative (albeit very hacky) is to make your sprite image bigger. You'll end up with a texture with more unused/transparent space, but you'd be able to have the "pivot" point located over the "center" of your texture.

Then you just need to adjust the collision poly of your sprite to ignore all the excess transparent areas of the texture.

I know it's hacky and probably a bad idea if you have large textures, but if you can't find an alternative it may help until pivots are supported in the engine (maybe that should be a feature request for TGB 2 :)