Off-Center Rotations?
Colty27
Member Posts: 7
Could Someone help me with "Off-Center Rotations", I can't quite figure it out. I want to rotate a cannon turret, but the rotation is centered on the barrel of the turret. Could Some one please help? Thank You.
Comments
Could try this, might work, might not:
Create real attributes for the cannons rotation point
Constrain then rotate
I'm new myself but saw no replies for thought i'd give it a go
Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!
@Colty27 Hi, although this can be done with behaviours, there's another straightforward way:
Remake your cannon
turret graphic, so that the centre point on the turret you want rotating is the middle, with added transparent space the other side of the graphic...
Here's an illustration of what I mean:
Now you can use rotate behaviours and it'll rotate properly as you want.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
You could use some simple trigonometry to position the centre of an orbital path wherever you want, add rotation at the same speed (and direction) of the orbital path and you can turn an object through any axis you want, it's not overly complex, you can do it with three constrain behaviours (X, Y + rotation).
Hold on, let me make a quick demo for you . . . . .
Here you go, a quick example file:
https://www.mediafire.com/?btx52fc273fy3dq
You can position the rotation point anywhere on an object (or outside of an object) using just the 'radius' value and an offset value for the 'game.time' part.
. . . . . but . . . personally speaking I'd do it the way gyroscope mentions.
One advantage to doing this using trigonometry (not really applicable in this case) is that you can do all sorts of magical wonderfulness, here's an example where I've put two centre points on a square, click anywhere on the screen to morph between the two centre points, not really much use in this situation but it shows you the power of simple trigonometry.
Link: https://www.mediafire.com/?ievfta74sf0doh0
Sweet! Thanks Everyone for your answers, really helpful @Socks!