I have a “floating” platform that moves vertically when touched by the player sprite in a physics based side scroller. I have sprites sitting on top of the platform that get thrown up in the air by the movement of the platform. Some times it goes through a few of the sprites rather than pushing them up, and some times one that gets thrown up just stays stuck in the “air” and doesn’t fall down using physics like the others. They are all instances of the same sprite.
How do I get this to work more realistically? I tried slowing down the movement of the tweening up, and it’s still doing it. If I slow it down any more, it won’t look realistic. I tried changing the sprites, that are supposed to get thrown by the platform, from “dynamic” to “bullet”, but it didn’t seem to make a difference.
The problem arises because you are mixing 2 mechanisms - moving by setting the position, and physics. Physics works with forces, and when you move am object by changing it’s position, that throws the physics out, because there aren’t any forces being applied.
One idea (and I’m not sure if it would work) is to consider creating a couple invisible objects that the platform is attached to via joints. The move those two objects with tweens, and let the physics joints move the platform, which in turn will act properly on the other sprites with physics behaviour.
That must be why it worked well when I used forces to move the platform instead of tweening.
I just didn’t like how the forces moved the platform.
I’m still pretty confused by physics joints, but I’ll look at the manual again and see if I can figure it out.
Is there a way to trigger a force to the sprites whenever the platform starts to tween up? It would need to just happen to the ones that are touching (sitting on top of) the platform that is moving. The platform and the sprites are all instances, so of course I wouldn’t want all the ones loaded in the scene to move.