playMaker

Author Topic: [SOLIVED] Object falling through the floor  (Read 2285 times)

frozze

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
[SOLIVED] Object falling through the floor
« on: May 21, 2014, 12:03:53 PM »
Hi.

I have a player. When I tap the screen the player jumps (add force). If the player is in the air I can swipe down and the player will be smashed into the ground (add negative force). However when the player is smashed down it falls through the floor.
How can i fix this? The floor has box collider and the player has a rigidbody and box collider.

Hope you can help me. I've attached a picture of the setup.
« Last Edit: May 22, 2014, 04:40:16 AM by Lane »

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • View Profile
    • My Blog
Re: Object falling through the floor
« Reply #1 on: May 21, 2014, 02:14:26 PM »
Have you enabled continuous collision detection on your player object's rigidbody? That might help. You can also turn up the physics iterations to insure there isn't penetration. Or make the floor thicker.



What you're looking at is physics tunneling, where an object moves so fast that the next frame puts the object on the other side of a thin wall. The collision is never detected because the object is moving so fast, it essentially teleports through the floor.

EDIT: Another fix is to use raycasts to determine valid movement- or that an illegal move didn't happen. Typically useful for bullets.
« Last Edit: May 21, 2014, 02:17:19 PM by TrentSterling »

frozze

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
Re: Object falling through the floor
« Reply #2 on: May 22, 2014, 12:13:36 AM »
Hi Trent.

Thanks for your reply.

Good explanation, I didn't know such thing could be possible. I've tried to enable continuous detection and created an invisible floor detector that is very thick. And that seems to have solved it.

Thanks!