Author Topic: Door moving and push the player?  (Read 781 times)

Offline auser

  • byte
  • *
  • Posts: 9
    • View Profile
Door moving and push the player?
« on: November 16, 2011, 07:48:40 pm »
Hi. I have tried jpct-ae and like it alot! But now i am stuck with the collision.
I have created a player who collide with the World objects. And now i created a door wich act good with the
movement. But now, when the door moves and push the player, the door goes through the player. In some way i need to check when the door hits the player and push the player.
Is there some solution to do that in a good way? Thanks for help :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Door moving and push the player?
« Reply #1 on: November 17, 2011, 08:01:59 am »
Depends on the collision detection method you are using. Ellisoid collision detection isn't suitable to push an entity out of an existing collision, i.e. if you don't prevent the door from moving into the player, the ellisoid detection won't be able to move the player out of this collision. However, the spherical collision detection can do this. So a rough idea is to move the door one step and then apply a spherical collision detection to the player with a translation of (0,0,0). The door has to be set to the proper collision mode of course. However, this might press the player into other geometry. I had the same problem in a game of mine. I simply reverted to keeping the doors open as long as the player is near. It's much less hassle that way.