rotation spazing

hey guys, so right now im using the off center rotation formula and it rotates to my mouse position, but when i get too close, it starts vibrating and glitching out. any ideas how to fix this?
Best Answers
-
pinata14 Posts: 150
hey, thanks, i meant that the actor does move, but it points at the mouse. specifically it is a turret on a tank that can move, but also points towards the mouse as an aiming mechanism. Although you said not much can be done, I have been working on something else and discovered a way to fix it. If anyone would like to know I would be happy to explain the solution.
Thanks for the attempt though @RThurman
-Ryan -
pinata14 Posts: 150
@SaladStraightShooter
hey, could you please implement a way to make the question "answered" for people who solve it themselves so that it does not remain a question on the forums? Thanks,
Ryan
Answers
self.SceneX -magnitude( self.OffsetX , self.OffsetY )*cos( self.Rotation +vectorToAngle( self.OffsetX , self.OffsetY ))
My question was about your statement, "... it rotates to my mouse position." The statement was ambiguous, since rotation is about angles, but position is about x,y coordinates.
Did you mean that the actor is rotating to the mouse's x,y position by rolling over to where the mouse is located? (It chases the mouse around the screen?)
Or does this statement mean that the actor is rotating to point at the x,y location of the mouse? (It constantly points at the mouse, but stays in at fixed location?)
I am going to assume that you are meaning that the actor is simply pointing at the mouse's x,y location.
Generally the 'spazing' comes from two sources:
1) getting the mouse angle from the center of the actor, instead of the screen coordinates of the rotation point.
2) extreme sensitivity to changes in angle at close ranges. (eg. a change of 1 pixel = 45 degrees when the mouse is right next to the pivot point. But a change of one pixel = 1 degree when the mouse is 360 pixels from the pivot point.)
You can't do much about problem #2, but problem #1 is fairly easy to correct. You need to adjust the rotation formula to something like:
Constrain Attribute: self.Rotation To: vectorToAngle( game.Mouse.Position.X -self.SceneX, game.Mouse.Position.Y -self.SceneY)
Hope this helps!
RThurman