Posted By
|
Message
|
Chloe Sagal under the influence of FUN
Registered 19/02/2009
Points 607
|
10th March, 2009 at 01:14:29 -
well, in my project i have the arms of my player to rotate towards where the mouse is pointing at, but it looks all redic when his arms move through his legs and head. im not entirly confident in how my system is set up to begin with (since its in some wierd loop that i copied from the aiming system i found that i still dont really understand 100%) so lets pretend for a minute the arm isnt doing anything, how do i get it to rotate towards the mouse, but at the same time stop when it reaches certain degrees?
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
10th March, 2009 at 02:24:42 -
Well, there are two things you can do.
First, you can have the arm always look at 0,0 from an object whose X is always XMouse and Y is always YMouse. Then don't have frames for the directions that look funky and use animation direction later to determine where it's aiming. However, that's not 360 degrees.
Second, you could use a math extension to determine the angle toward the mouse from the arm. Using the "compare two general values" function, you can test if the angle of the arm is less than or greater than the angle needed to aim at the mouse AND the current angle is less than and greater than the weird angles. If so, then add or subtract 1 degree. (Or alternatively latch directly on to the correct degree when the needed angle is not a weird angle) I don't have MMF2 so I can't give specific syntax. (I THINK MMF2 has built-in sine and cosine functions... you may be able to pull it off without extensions)
So pretty much this post is useless.
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
10th March, 2009 at 02:32:19 -
will this do, I made an example of both of OMC's methods
http://www.jsoftgames.com/aimengine.zip
n/a
|
Chloe Sagal under the influence of FUN
Registered 19/02/2009
Points 607
|
10th March, 2009 at 03:23:51 -
yeah, that did it, and horribly simple too, and with a little bit of tweaking i got it so hes not moving the gun through his head and legs by doing
always
set current angle(var) to (calculation)
if current angle is above 0 but below 50
or
if current angle is above 130 but below 240
or
if current angle is above 300 but below 360
then set angle to calculation, second arm mimmick 1st arm angle
then top it off for checks in between the "no fly zones" and direction checks keep the arm from bending back behind the player all retard like.
thanks guys!
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
10th March, 2009 at 12:09:06 -
Thanks Urban Monk!
(I'd check your example out, but alas, I haveth not MMF2. )
Edited by OMC
|
|
|