Keeping it Up Front.
belleech
Member Posts: 34
Hi Guys
I have this actor that has to have a shield in front of it. The actor rotates 360 and I know how to constrain the shield X , Y pos relative to the actor. But the problem is, I cant seem to have the shield rotate to be always north side or in front* of the actor. When the actor and shield rotates, the shield rotates in position fixed position and looses the north pos relative to the actor. Anyone tried to crack this one?
Regards.
I have this actor that has to have a shield in front of it. The actor rotates 360 and I know how to constrain the shield X , Y pos relative to the actor. But the problem is, I cant seem to have the shield rotate to be always north side or in front* of the actor. When the actor and shield rotates, the shield rotates in position fixed position and looses the north pos relative to the actor. Anyone tried to crack this one?
Regards.
Comments
Constrain the actor's Rotation attribute to a game attribute. (Assuming actor at 0 rotation faces right.)
Also constrain the actor's position to game attributes (game.ActorX and game.ActorY).
Constrain the position of the shield to the distance or radius(r) from the actor to
shield's self.Position.X = r*cos(game.ActorRotation) + game.ActorX
and
shield's self.Position.Y = r*sin(game.ActorRotation) + game.ActorY
and constrain the shields rotation to the actor's rotation as well.
How do you view your favorite posts now??
http://gamesalad.com/game/play/39926
The second was CodeMonkey's dual joystick demo. UtopianGames was trying to copy my "chainsaw" fix into it to make a lightsaber always appear in front of the "jedi" actor (the four color circle in CM's demo...I couldn't resist making it into a cheaply drawn cloaked character though):
http://gamesalad.com/game/play/40513
The only thing you would do differently would be to constrain the shield's rotation to the main actor's (i.e. the ship) rotation to force it to always be in front. As it stands right now, in the "chainsaw" demo, the "chainsaw" orbits its actor. In the "jedi" demo, the lightsaber is controlled with the second (left/red) joystick. Just constrain, and you should be able to keep it up front.