playMaker

Author Topic: Jump and fall setup help using Collision Event  (Read 829 times)

Adam Z

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Jump and fall setup help using Collision Event
« on: February 08, 2018, 01:31:05 PM »
So I have a basic jump/fall setup using 3 States. All the objects the player can land on have a "Ground" tag. The 3 States are:

"Waiting" State
  • "Get Button Down" for jumping. Transitions to "Jump" state when pressed.
  • "Collision Event" > On Collision Exit with Ground as the Collider Tag. Transitions to "In Air" state when the player starts to fall.

"Jump" State
  • "Set Velocity" on the Y axis. Transitions to "In Air" state.

"In Air" State
  • "Collision Event" > On Collision Enter with Ground as the Collider Tag. Upon collision with the "ground" tag, transitions to the "Waiting" state.

So the ideal is when my players capsule collider leaves a "ground" id tagged object, the character is falling. It works except when there is a slope. I'm using a cube with a box collider, scaled as a ramp, and then angled. It seems that the angle causes the "In Air" State to activate when I transition from a horizontal plane to the slope. I don't think the angled collider plays nice with the capsule collider.

Any thoughts on how to fix this or use another solution?

Thanks.
« Last Edit: February 08, 2018, 02:05:43 PM by Adam Z »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4586
    • View Profile
    • jinxtergames
Re: Jump and fall setup help using Collision Event
« Reply #1 on: February 09, 2018, 03:29:10 AM »
Hi.
1st thing that came on my mind is to use a trigger and make it a little bit higher than the ground 'slope' level.

And then maybe a "Slope" State

Adam Z

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: Jump and fall setup help using Collision Event
« Reply #2 on: February 09, 2018, 07:15:06 AM »
Hi.
1st thing that came on my mind is to use a trigger and make it a little bit higher than the ground 'slope' level.

And then maybe a "Slope" State
I appreciate the idea, but I wanted to do the least amount of setup for a 3rd person shooter. If the world is large or has a few maps, then thats a lot of setup.

Maybe I can use Raycast from the players origin, and if it doesn't hit anything after a certain length, place the character in a "falling" state.  Then maybe check the duration and if the player is "in air" for a while, when you hit a surface you're "dead".

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4586
    • View Profile
    • jinxtergames
Re: Jump and fall setup help using Collision Event
« Reply #3 on: February 09, 2018, 05:10:22 PM »
Hi.
Or maybe you can use the velocity, speed or force (collision event / get collision info)
When it hit  the floor and if it is harder or faster than a certain amount then "Dead"