Calculating Rotation Relative to a Fixed Point?
Hey all! This is my first time on the forums, and I'm new to GameSalad (though I have previous coding experience).
I'm wondering if I can get multiple actors to rotate around the center of my scene. I want them to move in relation to the center, acting like something that tries to move forward but is tethered to a pole; the rope forces the thing to rotate around the pole it's tethered to. I'm trying to figure out whether I need to do some calculations for this, or if there's a built-in behavior I'm just not seeing. If it requires calculations, somebody's gonna have to help me (read: do them all for me).
Am I making myself clear at all? Regardless of whether or not I get any help, thanks for reading.
I'm wondering if I can get multiple actors to rotate around the center of my scene. I want them to move in relation to the center, acting like something that tries to move forward but is tethered to a pole; the rope forces the thing to rotate around the pole it's tethered to. I'm trying to figure out whether I need to do some calculations for this, or if there's a built-in behavior I'm just not seeing. If it requires calculations, somebody's gonna have to help me (read: do them all for me).
Am I making myself clear at all? Regardless of whether or not I get any help, thanks for reading.
Comments
You will need to use cos and sin.
Darren.
While I'm at it, is there a way to have music continue from scene to scene? As is, each level of my game is a different scene, and the music restarts each scene.
http://gamesalad.com/forums/topic.php?id=33949
the question is in the forum, im not sure if gs is capabile of a mechanic i need to finish my game
This will all be much easier once joints are implemented. But in the meantime I created a template where the walls rotate around and move in relation to a grey box. It requires a bit of trig but the formulas can be readily cut and pasted into your game.
Give it a try:
http://www.speedyshare.com/files/31031054/RotationRelToFixedPoint.zip
Hope this helps!
The rotation's been working great, but there's one problem. I cannot rotate the stage twice in the same level. The first time, everything follows fine, but the second time, the dynamic actors (objects effected by physics, like the player) have their positions messed up. I've deduced that the problem is with the rotation attribute, because the rotation does not change based on the positions of the objects, causing them to revert to positions near where they began rotating last time.
Thoughts?
Nice concept for a game though. I'm working on a similar idea -- but just for learning GameSalad -- not necessarily anything commercial.
http://speedy.sh/TWXqC/boxRoll.zip
I haven't had a chance to get a look at what you just posted, I'll see how it goes.