Author Topic: how to do this?  (Read 2374 times)

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
how to do this?
« on: June 28, 2011, 11:36:40 pm »
Hello I was wondering how I can make my main character push objects?  I made it so when he collides with a pushable object, it will move in the direction he is facing, but then when he jumps on top of it, it will move out from under him.  How can I detect that he is colliding with the top part of the object to prevent it from moving?  Does this involve getting the mesh and then the bounding box?

Thanks.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: how to do this?
« Reply #1 on: June 29, 2011, 12:25:49 am »
Why not simply ignore the y-vector in the movement?

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: how to do this?
« Reply #2 on: June 29, 2011, 12:53:23 am »
sorry what do you mean? do you mean there is a way to ignore collisions due to y vector?  My object does not move in the y direction it moves only in the direction that the character is facing, either x or z or combination of the two, but even when my character is on top of the object the gravity keeps colliding him with the object below and it moves forward even with my character not moving.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: how to do this?
« Reply #3 on: June 29, 2011, 08:07:18 am »
I see...then compare the transformed center of the object with the one of the player and if the player is above the object, don't move it.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: how to do this?
« Reply #4 on: June 29, 2011, 10:01:25 am »
I was thinking of doing that, but I was thinking that wouldn't work if my player was taller than the object itself, then he would never be able to push the object because the y coord of the player's center would always be higher than y coord of the object's center.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: how to do this?
« Reply #5 on: June 29, 2011, 10:15:53 am »
Don't use the absolute coordinates but some delta values instead.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: how to do this?
« Reply #6 on: June 29, 2011, 11:25:12 pm »
What do u mean?  You mean if the difference between the y's is greater than a certain value (which will be different for each object) then don't have the object move?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: how to do this?
« Reply #7 on: July 01, 2011, 11:59:51 am »
Just use some educated guess...i really depends on the level design and scene setup. It's impossible to advise a proper strategy without knowing that. But in general, i would try to find some upper bound for collisions. That may either be the absolute position of the player or it's y-distance to the object.