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
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
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?