playMaker

Author Topic: Ground Check without collision event  (Read 907 times)

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Ground Check without collision event
« on: January 16, 2021, 02:13:25 PM »
Hello,

I'm wondering if there is a way to check if I am grounded without using a collision event. The reason I want to do this is because I have a collectible and when I collect it in the air, the FSM doesn't fire, but when there is no collision event, it works fine. Basically, as you might assume, I need this to prevent infinite double jumping. Thanks!

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Ground Check without collision event
« Reply #1 on: January 17, 2021, 01:51:09 PM »
Bump

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Ground Check without collision event
« Reply #2 on: January 17, 2021, 02:05:16 PM »
Do you have different tags for ground and collectable ?

Still, your issue is no clear. can you post FSM of ground check and collectable FSM ?

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Ground Check without collision event
« Reply #3 on: January 17, 2021, 09:55:43 PM »
Here are the FSMs. For the first state in the collectible FSM, I have a trigger2d event, then in the next and last state of that FSM, I have an int add and an activate game object (turned to off so it disappears)

For the jumping FSM, I have in state one a trigger 2d event. In the second state (labeled state 5, sorry, really bad at labeling my stuff), I have an int add (I have a mechanic I'm trying to implement where each time you get a collectible you jump a little higher). In the next state (labeled state 2) I have a get key down and a trigger2d event. In the state labeled state 3, I have add force 2d, then in state labeled state 4, I have the collision 2d event (which can be removed to enable being able to have the FSMs fire for collectibles in the air, but also enables infinite double jumping).

And yes, my tags are labeled differently.

Hope that helps. Thanks again!

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Re: Ground Check without collision event
« Reply #4 on: January 20, 2021, 09:30:56 PM »
Bump

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Ground Check without collision event
« Reply #5 on: January 21, 2021, 05:44:37 AM »
Hi.
In our game we use raycasts to check floor.
I have it on a separate fsm.
It has 3 raycasts (left right and center of the player)
and i store the did hit bools
then i have actions called bool any thru to check these bools.
and that result i also store in a bool (grounded).

Then in other fsms where i need to check if grounded i use 'Fsm Bool Test' (Ecosystem)