[SOLVED] Rigidbody back forth jittering Issue on IOS


#1

Hey guys, glad to back with some new queries.
I’m really stuck in a problem and I have tried various ways to solve it but alas! I need your guidance to escape out from this situation.

I’m building an endless running game using play canvas, the game itself works completely fine on android ,PC and MAC devices it only creates issue on an iphone (tested on iphone 6 and iphone 7+).
The character in my game randomly jitter back and forth sometimes on iphone devices , dont know whats causing the issue can any one point me out in the right direction
Following is the video of my game:
VIDEO

I have following settings of the player:

Kindly help me out to resolve this issue on ios.
Thanks


#2

Just from the video, I couldn’t really have a guess.

The physics looks fine as the the camera itself doesn’t jitter and I assume it is following the rigidbody?

Are the rigidbody and the mesh separate entities? How is the rigidbody being moved on the road? Velocities, forces etc?


#3

rigidbody is moving with

`
forward = this.entity.forward;

right = this.entity.right;
x -= forward.x;
z -= forward.z;
if (x !== 0 || z !== 0) {
    x *= deltaTime;
    z *= deltaTime;
    force.set (x, 0, z).normalize ().scale (this.speed);
    this.entity.translate (force);
    this.entity.rigidbody.syncEntityToBody ();`  

and yes camera is following the rigidbody.
Rigidbody and mesh instances are seperate entities as main entity hosts both player and scooter.

And this issue is occuring on ios devices so dont know if its a physics issue or something else?


#4

As an aside, this may give odd behaviour as the rigid body is effectively being teleported every frame.

At that point, you may as well use the PlayCanvas shapes (https://github.com/playcanvas/engine/tree/master/src/shape) as you aren’t really using the physics for simulation and check for overlaps every frame. You shave off a 1.5MB from not needing ammo.js.

If the camera is following the rigid body and not the mesh, then it points to it not being a physics related issue.

That said, try changing the rigidbody to be kinematic instead. Maybe the rigidbody is getting caught on something and changing it to kinematic should stop that if it is happening.


#5

you are right I dont need to sync up movement if im not using physics for simulation , I thought this would sync up my movement from normal translate to rigidbody factor of adding force, im quite new in playcanvas and coming from unity3D / unreal I just kind of mixed up some of the physics concepts of engines.
Anyway, Really thanks a lot, changing the rigibody to kinematic resolve the issue so that it would not receive any undesirable external force.
And also thanks for the tip to shave off 1.5MB :slight_smile:


#6

If you have a camera script that updates itself based on the location of the rigid body, you might want to rename the update method to postUpdate - on a project I’m working on, this helped get rid of some jittering I was seeing.