how to use move_and_slide on a rotating platform?

icqqqicqqq Posts: 34Member
edited February 2018 in 3D

I want to achieve a character can follow a rotating platform to move.
However I found move_and_slide do the job but is not perfect.
Somehow when time moves, the position of kinematic character will shift.

So how to solve it?

My code in kinematic body:

vel = Vector3()
func _physics_process(delta):
vel.y += g*delta
vel = move_and_slide(vel, Vector3(0, 1, 0))

My rotating platform is a rigidbody in kinematic mode and rotated by animation player

Thanks!

please find my project in the link:
https://drive.google.com/file/d/19mSzlSlZkkp7AuoEKnE0yudV5-kn47r8/view?usp=sharing

Best Answer

  • MegalomaniakMegalomaniak Posts: 1,506
    edited February 2018 Accepted Answer

    I mean if you place something on top of a rotating object such as a turn table it experiences centripetal acceleration(because friction).


    @icqqq said:

    However, the body will shift and finally move out of the platform.

    So in other words add/raise friction, also might help to lower objects pivot point or whatever determines the center of mass. Also, raise mass or gravity. Plenty of ways to cheat against physics in a game engine.

Answers

Sign In or Register to comment.