Platform horizontal movement and friction (SOLVED)

Hello,

I want to create a platform with horizontal movement. when tle player jumps into the platform, i would like that the players moves with the platform.

i have tried it, but when the player is over the platform it doesn’t go with the platform. is like it was 100% slippery.
I put the friction at maximun value in both collision objects, but nothing happened. :disappointed:

is there any example?
thanks in advance.

I have a similar scenario, but haven’t gotten around to testing it yet. My plan was to set the platform game object as a parent to my hero character. That way, it would start following the platform. This should work well for kinematic bodies. The velocity of the character needs to be converted into the local space of the platform, so the character doesn’t suddenly run extra fast. (Again, haven’t tested this yet, “maybe this weekend ™” )

If both character and platform are dynamic it should work. But remember that friction must be set on on both the character and the ground.

combined_friction = math.sqrt(shape1_friction * shape2_friction)

for restitution:

combined_restitution = math.max(shape1_restitution, shape2_restitution)

The player and platform are kinematic.

You could calculate the positional difference between the player and the platform on initial contact and then in your update check the difference in position and use the difference between the differences to update the player position, then when you move the player with whatever controls you are using, you update the difference as well as the players position. Then when you leave the platform you ignore the difference.

it works! thanks

Ok, kinemantic objects only register collisions. You will have to do all calculations for friction etc (if that is what you want) yourself. Dynamic objects are solved by the physics engine and restitutions, mass etc are included in the calculations.