What is the best way for me to make several rotating cannons on a navy ship that rotate to the mouse position and stay mounted on the ship? (The ship will move in any direction)
make 2 real attributes and constrain those attributes to the ships x and y.
Then constrain the cannon's position to those attributes. You can add any offset you would like for them in the expression editor.
Then to get them to rotate to face the mouse, you can constrain the rotation to vectorToAngle(mouse.position.x-self.position.x,mouse.position.y-self.position.y)
I have two videos on turrets as I'm building a tank game you might find helpful. The first is tracking an enemy with a rotating turret and the second is turret artificial intelligence.
Comments
Then constrain the cannon's position to those attributes. You can add any offset you would like for them in the expression editor.
Then to get them to rotate to face the mouse, you can constrain the rotation to vectorToAngle(mouse.position.x-self.position.x,mouse.position.y-self.position.y)
cheers
Gleeson Group Media
UNoffical Gamesalad Guide
FREE and easy to use. Contains all well done video tutorials for Gamesalad.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS