I have a problem facing my monster in the right direction. Here's my code:
Zero Rotatmunster (monster monster) {float deltaX = monster.Target.X - monster.coordinate.x; Boat Delta Y = Monsters. aim. Y - Monster. Flag tangetable = deltaax / delta; Demon. Rotation = (Float) Math Atan (tangents); } The problem I am facing is that sometimes the monster moves backwards, it can tilt in the wrong direction, will someone please explain to me what I do I am wrong?
you deltaX and deltaY values symbol To determine what to do with the result of ethan method etan method is not known that you have to calculate positive or negative The values are used tangent, eg it can not tell the difference between 100/50 and -100 / -50 For some combinations you need to add half rotation to the angle. Which values do not really hold on to me, but basically something like this:
float angle = (float) monastery. Atan (tangents); If ((deltaax and lieutenant; 0 & amp; amp; deltaa = gt; = 0) || (deltax> = 0 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; Delta \ lt; 0) ) {Angle = angle + monastery PI; } Demon. Rotation = angle; ... or some other combination of positive and negative values, you should be able to find out what gives you the right result for your coordination system.
No comments:
Post a Comment