vectortoangle
Hey everyone
I want to make so when a touch the scene the rocket will move there
so I create attribute move? bool false
IN BACKGROUND
when background touch is press, change attribute move? to true
IN ROCKET
when attribute move? is true, interpolate the rocket' X and Y pos to touch X and Y
that is easy enough
but now I want the rocket to face the point were is flying
so I do
IN ROCKET
when attribute move? is true, constrain attribute self.rotate to
vectorToAngle( self.Position.X - game.Touches.Touch 1.X , self.Position.Y - game.Touches.Touch 1.Y )
but something seems wrong because it will sometimes rotate to 30 degrees more right
Thanks
Calvin
_______________________________________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/
I want to make so when a touch the scene the rocket will move there
so I create attribute move? bool false
IN BACKGROUND
when background touch is press, change attribute move? to true
IN ROCKET
when attribute move? is true, interpolate the rocket' X and Y pos to touch X and Y
that is easy enough
but now I want the rocket to face the point were is flying
so I do
IN ROCKET
when attribute move? is true, constrain attribute self.rotate to
vectorToAngle( self.Position.X - game.Touches.Touch 1.X , self.Position.Y - game.Touches.Touch 1.Y )
but something seems wrong because it will sometimes rotate to 30 degrees more right
Thanks
Calvin
_______________________________________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/
Comments
constrain attribute self.rotate to vectortoangle (touchX, touchY)
Should work.
You might want to check these
Is moveable set to on?
Is Fixed Rotation turned to off?
You could also try this:
When Move? = true
Constrain Attribute Self.Rotation to VectorToAngle (Self Motion Linear Velocity X, Self Motion Linear Velocity Y)
Thats typically how I get it to work.
is annoying
_________________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/
Also, going to bed!
When mouse Button is down
--Rotate to VectorToAngel(self.position.x-mouse.position.x,Self.position.y-mouse.position.y)
Or you could just use a change attribute with the same expression if you want it to just snap to the direction.
But that is the same thing I did, will Try again
I will do it
____________________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/