Moving an Actor forward in its rotation
Hey Guys,
I have a few rules set up where if "keys" (left/right) are pressed to change the rotation of the actor CW / CWW. Ideally I want this same actor to "move forward" (currently using accelerate) with a "key" (up) pressed state, the problem I have is that it's moving forward but not in the angle it's supposed to move.
I know the vectorToAngle(x,y) with LinearVelocity formula but it's not working, maybe Im just not implementing it correctly.
Thanks for your time!
I have a few rules set up where if "keys" (left/right) are pressed to change the rotation of the actor CW / CWW. Ideally I want this same actor to "move forward" (currently using accelerate) with a "key" (up) pressed state, the problem I have is that it's moving forward but not in the angle it's supposed to move.
I know the vectorToAngle(x,y) with LinearVelocity formula but it's not working, maybe Im just not implementing it correctly.
Thanks for your time!
Answers
Thanks!
How do I use the accelerate behavior to move my actor just like the Dozer from PuzzleDozer?
I have the rotation set up already.
Please point me in the right direction. Thanks!
-Accelerate relative to actor direction 0 like tshirt said.
Also add some drag to the actor, and maybe friction. Its under its physics attributes.
Thanks!
Im having a hard time replicating on how the 'dozer' moves in PuzzleDozer. Rotate left/right whilst moving forward is whats getting the best of me. All these movements are being "ruled" with on press KEY events.
Any headsup would be appreciated!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Try adding drag and friction maybe density . There in the physics attributes. Just play around with the amounts.
It seems like im "drifting" when moving my actor. When I press UP to move forward and turn, the actor turns on its axis but doesn't move torwards that angle of direction unless I press the UP again. (up having the acelerate behaviour to move forward)
Ad a constrain to your actor and do the following.
Constrain self.rotation to vectortoangle(self.motion.linear velocity.x,self.motion.linear velocity.y)
That way the car always points in the way it is moving. As @tShirtBooth says, make sure you have the actors image pointing to the right!
Lump Apps and My Assets
That doesn't work makes my actor go crazy when I turn him, remember I have a Rotate CW on keypress RIGHT.
Perhaps when you fake pushing the up button by adding a forward movement when you turn as well as the rotate cw/ccw. That would keep the car rolling when you turn though.
Lump Apps and My Assets