Constrain rotation to touch
Fal01
Member Posts: 460
Can anyone tell me how to constrain the angle of an actor (crossbow) to touch, in a sweeping motion like a windshield wiper?
Any help much appreciated.
Any help much appreciated.
It’s not a bug – it’s an undocumented feature
Comments
when mousedown
-- Constrain Attribute: self.rotation To: VectorToAngle(game.mouse.X - self.Position.X,game.mouse.Y - self.Position.Y)
It works, but I can only control it from the side.
Is there a way to control it from the middle? The actor is a crossbow facing the top of the screen and I need the touch position to be in the middle of the crossbow where the arrow is.
Thanks again for your help.
It’s not a bug – it’s an undocumented feature
Does your crossbow (and arrow) graphic start at the '0' rotation? It should be facing directly to the right ----->
That is the '0' direction.
If it is not correctly oriented to '0' then the crossbow will not track the touch correctly.
Hope that is what you are asking about!
Sorry for the confusion, I am making a faux Z space crossbow facing the top of the screen.
It’s not a bug – it’s an undocumented feature
The image needs to match the beginning orientation of the actor. It needs to face right.
First, you import the image, and then place the image into the actor prototype. (It will be facing to the right.) Then you drag an instance of the prototype onto the scene and rotate it to face upwards.
And then the equation will work properly.
Thank's a lot for your help!
It’s not a bug – it’s an undocumented feature