Constrain the angle of the canon towards the player
I guess you guys have a quick answer for this.
I want a canon that always points towards the player position. So I can place multiple canon's at different locations that all point to the player.
I constraint the X and Y of the Player as global game variables.
Within the canon actor code I did
(vectorToAngle( game.PlaneX , game.PlaneY ))
So I got the angle for the Player.
So now I have to figure how to get the coordinations of both compared so when I move my player it checks the difference between this two actor types.
How exactly would that work?
Comments
@BigDave, vectorToAngle takes the difference between Tower and player position.
So you need to do
vectorToAngle(self.Position.X-game.PlaneX,self.Position.Y-game.PlaneY)
then rotate the tower to that angle.
@Hopscotch Thanks man! Let's try it.
@Hopscotch
Hat to add the start angle behind but else it worked perfectly!
vectorToAngle(self.Position.X-game.PlaneX,self.Position.Y-game.PlaneY)-90
Thanks again. This thread is answered.
You can also do this with the Rotate To behaviour . . . .
@socks
haha wtf thats awesome!