I want to make a car game with movement by Arrow keys.
The problem is the car jitters on surfaces of imported objects made with sketchup. The collider mesh is the json file.
Moving on primitives added in playcanvas works fine.
you can test this in the game. The green ramp is a primitve, the grey ramp is the imported one.
Is there a best file format for import? I tried fbx too, but its the same problem.
Example Editor
play
Overview / project
It looks like the car is bouncing on the surface as it is happening even on the flat plane. I would check if you are applying impulse at an angle up or down by look at the XYZ of the forward vector.
thanks
There has been an impulse at the y-Axis( up-down), one could see at the console
if(this.app.keyboard.isPressed(pc.KEY_UP)){
this.impulse = new pc.Vec3();
this.impulse.copy(this.entity.forward).scale(this.speed);
console.log(this.impulse.y);
this.entity.rigidbody.applyImpulse(this.impulse);
}
so I tried this, putting the impulse only in horizontal Direction
this.entity.rigidbody.applyImpulse(this.impulse.x , 0 , this.impulse.z);
, but its not better there is still a strong jittering at imported objects
if(this.app.keyboard.isPressed(pc.KEY_UP)){
this.impulse = new pc.Vec3();
this.impulse.copy(this.entity.forward).scale(this.speed);
console.log(this.impulse.y);
this.entity.rigidbody.applyImpulse(this.impulse.x , 0 , this.impulse.z);
}
the drive code
The jittering has nothing to do with the code, Its the collider
a mesh collider with json Files show the jittering,
the cube collider doesnt, it is a smooth movement
https://launch.playcanvas.com/624575?debug=true