Hiya, trying to make a game where the character's arms are supposed to be rotated in the direction where the mouse pointer is. I'm using the "Set angle" condition. Anyone happen to have some formula or trick up their sleeve that I could use?
That didn't work either. The arm is just spinning like crazy. And when the pointer is too far away it won't respond anymore. Is there some example somewhere I could use?
Can't you make the arm as a separate objected glued to the player? Then give the arm 32 directions and set it to always look towards the mouse pointer.
If your player character is small, the user won't notice the small graphical glitches that is caused by the few 32 angles. And if you character is a little larger, using the rotate function will make the program run slow.
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
25th November, 2007 at 23:50:51 -
I would simply used the Advanced Direction Object, then use one of its actions to get the direction between two points. You would simply have to set the direction of the arm to that.
The Atan thing works perfectly. I asked about 2 weeks ago. Just need to convert it to degrees. Thats it. It takes two events.
One for Xmouse is greater than XArm
180 - ATan((Y( "mouse" )-Y( "right arm: empty" ))/(X( "mouse" )-X( "right arm: empty" )))
and one for Xmouse is smaller than Xarm.
0 -ATan((Y( "mouse" )-Y( "right arm: empty" ))/(X( "mouse" )-X( "right arm: empty" )))
I think its that way. Try reversing them. It should work. You also have to convert it to degrees by dividing it the whole result by Pi and multiplying it by 180.