[SOLVED] How to reduce sliding/jitter between two rigidbodies

I have this sideways moving platform as show in this video

How can I reduce the sliding, somehow add stickiness between these two rigids, while still keeping movements, the jitter is also a problem, but isn’t so noticable while not recording screen.

Both rigids have a friction set to: 1, restitution to: 0
Player mass: 70, platform: undefined

Ammo gravity: Y -150 (to avoid player from standing in mid air when platforms are going to -Y)

Any ideas?

1 Like

Thanks for resources, forked and working on it!
Stuck on normalizing players movement force once I apply platforms velocity on it.

https://playcanvas.com/project/1014370/overview/test

I’ve ported it to my project,and it seems I can’t really sync it, the best result I can get happens with -10 gravity, take a look at these examples, -10 vs -100 Y gravity.
while going down is mostly perfectly fine, both moves the same speed, going up is somewhat different - offseting
-10

-100 gravity is total disaster

Okay, I can get nearly perfect sync with 0 gravity with this (jitter is lag from recording)

``````this.finevelocity.x = this.velocity.x*(1.08/dt);
this.finevelocity.y = this.velocity.y*(1.08/dt);
this.finevelocity.z = this.velocity.z*(1.08/dt);
this.player.rigidbody.linearVelocity = this.finevelocity;

``````

No idea why 1.08 to be honest

Will try to make it sync with negative gravity Y now

Update: Okay if the negative Y gravity is applied it becomes too tricky, you need to calculate Y velocity + gravity setting, depending if platform is moving up or down, I’d rather just set gravity to 0 once player is colliding and set back to -50 (or whatever) once player start moving e.g pressing WASD space or shift in my case

So the final result is not so bad if we don’t look at the lag

still needs a little tweaking

Do I understand correctly that you set the gravity of the whole project to 0?

Yes, it’s sort of way around, once player starts moving on a ramp (e.g pressing WASD) I set the gravity back to normal, and once stops, since the gravity is normal again and pushes down player immeadeatly it starts contact (collide) with ramp again so its moving nicely.

The other way would be to calculate velocity based on at least two factors
if we use the same calculation for velocity on up/down it does not sync as it should due to gravity

A: velocity = if ramp is moving up + (gravity pushes player down)
B: velocity = if ramp is moving down + (gravity also pushes player down but less than A)

It seems too complex for a newbie like me haha, you’d still have to find out when tween is changing its direction

Also the tricky part is animations, some of the may move a little to fast if animation duration is low (ElasticInOut) and distance to travel is high, the script just delays a few frames and your player is not standing on ramp anymore but a few inches upper while velocity is still great, the trick is to enable normal gravity again every x frame, is there a way to know when tween is turning around?