I’m guessing there is a simple way to do this instead of making collision event and then trying to force the game character keep up with the x-position of the platform.
edit:
I’m now trying to call a function in postCollision to make a pivot joint between the character and the moving platform. This ends up crashing the game.
I have tried to do this with performWithDelay and the result is same. [import]uid: 10416 topic_id: 6683 reply_id: 47030[/import]
If not, then you have to use the old school method of games, if the player has landed on the platform, set a flag and when you move the platform, move the player with the platform.
Yep, I do use physics for movement (ie. use applyForce to jump etc)
I just cannot get the joint created automatically between the player character and a platform.
If I try to make the pivot joint outside a function, it works. If I just place the function around it and call it from another (enterFrame) function it crashes:
local function anchor()
pivot = physics.newJoint(
"pivot",
gamecharacter, platform,
platform.x, platform.y
)
end