Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Prototype_6492 on August 10, 2018, 11:29:05 AM
-
I need my character to jump whenever a ray is not hitting the terrain, or any ground object for the matter.
Is there a way to detect when the ray is not hitting a game object? So then it can it proceed to forcing the character to auto-jump?
-
Put something around the camera that will move with it and serve as "nothing" and have an appropriate tag? So when you hit that instead of terrain, you will jump. Some edge colliders perhaps.
-
I'm not sure why I didn't think of that. Thank you!
-
I like krmko's solution, it should be a very robust method.
If it doesn't work out though you can also set a max distance for a raycast and trigger a miss event when it doesn't hit an object.
Layers will come in handy too if you need to enable/disable the jump occurring in certain circumstances. You might consider including a state or two to setup the regrounding process that will prevent your character from endlessly jumping into the air after the initial jump. That will obviously depend on the context of your character controller though.