Hi, I'm developing a top-down game where player can stand above moving platforms.

I've found solutions for this, either by recording an stand anchor relative to the platform and setting the position of the player to it on every step, or using a PinJoint (tried with RopeJoint but didn't go well).

The problem is I need the player to collide with bodies welded on top of the platform, and:- In the first case (setPosition) the player just ignores the bodies.- In the second (PinJoint) the player pushes the welded body, causing the platform to move as well.

Is there any solution? Is there any way to make that forces applied to welded bodies don't affect the platform?

Thanks in advance.

PS: One solution would be to use a PinJoint for every body I want to be on top of the platform, so that their interactions don't affect the platform, but I think that would reduce performance (I guess a WeldJoint is more performant than using a PinJoint and setting it's target at every step, isn't it?)

soylomass wrote:Is there any solution? Is there any way to make that forces applied to welded bodies don't affect the platform?

So you want collisions with the welded bodies, but you don't want the collisions to affect the platform body? They grey bodies - are they movable with respect to the platform? If not, I'd just make them part of the platform body and make the platform INFINITE mass. So something like:

That could be a solution, but I forgot to say I need the platform to be dynamic, affected by forces.

For now, I've solved it by making the welded bodies LINEAR_FIXED and setting their linear velocities to the linear velocity of the points they are fixed to (correcting it's position over time). I don't know how performant it will be when there are a lot of bodies though.

soylomass wrote:For now, I've solved it by making the welded bodies LINEAR_FIXED and setting their linear velocities to the linear velocity of the points they are fixed to (correcting it's position over time). I don't know how performant it will be when there are a lot of bodies though.

No problem.

As for performance, I wouldn't worry about it. The only thing I can think of that might impact performance would be that the WeldJoint (and most joints for that matter), perform position correction in the position solver. The position solver iterates until all joints and contacts are within the linear distance tolerance or the maximum number of position iterations has been reached. It can exit early (thereby improving performance) if everything is within that tolerance. Changing the position or velocity could cause the solver to iterate the maximum number every time (default is 10 I think). However, if the manual change in position/velocity is small, then it might have no effect.