playMaker

Author Topic: AddForce 2D Causes Player Sprite To Skip/Jitter?  (Read 2040 times)

SandstroM

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
AddForce 2D Causes Player Sprite To Skip/Jitter?
« on: November 04, 2014, 06:32:27 PM »
Hey guys, i'm having a bit of trouble with moving my player character smoothly.

I'm using "AddForce2D" to move my player's ship. It can move around just fine, and it works as i want it to - except every second or so i get a small "jump" or "skip" on the player sprite. Originally i thought it was my camera (Because it is set to follow the player therefore showing the skips too) or the Vsync options, but looking in the scene view at runtime I noticed it was JUST the player ship having skipping/jumping issues. After some research i saw people have been mentioning a "FixedUpdate" solution for the "AddForce2D" script, that apparently can help/fix it - but im not sure i want to edit the code of these functions without first consulting you guys.

Also its worth mentioning that i can move the ship without the skipping if i use translate, but it does not have the gravity force that i want like AddForce does.

If anyone can help me out with this, that would be fantastic, as i'm really not sure why it is doing this.

Thanks =)

 

SandstroM

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #1 on: November 04, 2014, 07:37:01 PM »
Oh yeah, i forgot to mention - im building for Android.

robmyers67

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #2 on: November 05, 2014, 05:01:29 PM »
This may have something to do with the scale of the sprite. Also you may want to look at the mass scale on the rigidbody combined with gravity.

Think this may help

Cheers

Rob

SandstroM

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #3 on: November 05, 2014, 07:06:39 PM »
Hey Rob, I have done multiple tests with more/less mass, interpolate/extrapolate, and a smaller/larger sprite - and i still get the same issue on movement. Been bugging me for a few days now XD

Thank you

SandstroM

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #4 on: November 05, 2014, 10:31:01 PM »
Still cant get this to work... anyone have any idea?

robmyers67

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #5 on: November 06, 2014, 02:56:35 AM »
just a thought and don't know if it is happening but is every frame checked?

SandstroM

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #6 on: November 06, 2014, 04:44:28 AM »
Yes, every frame is checked, the player will be flying a space ship so i need the force to be applied constantly

robmyers67

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #7 on: November 06, 2014, 06:56:43 AM »
Is it interacting with other rigid bodies in your scene. I had an issue where one rigid body was effecting the other

SandstroM

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: AddForce 2D Causes Player Sprite To Skip/Jitter?
« Reply #8 on: November 07, 2014, 02:06:22 AM »
The only interaction it has with other rigidbodies is when the ship collides with another, theres only 1 rigidbody per game object.