Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Obi Collider and Jump
#1
Lengua 
Hello. Thank you for a wonderful product Lengua . I have a question.

I'm using a sphere (RubberBall) as a character with Softbody Controller. On various game objects I put a Obi Collider script. The problem is that I can use "jump button" off all surfaces even vertical ones, can I somehow mark that this is not the ground? Confundido .

Best.
Reply
#2
(29-01-2023, 10:36 AM)grinog4 Wrote: Hello. Thank you for a wonderful product Lengua . I have a question.

I'm using a sphere (RubberBall) as a character with Softbody Controller. On various game objects I put a Obi Collider script. The problem is that I can use "jump button" off all surfaces even vertical ones, can I somehow mark that this is not the ground? Confundido .

Best.

Hi!

You do this the same way you would for any other game in Unity. There's many ways to determine whether a collider as "ground" or not, none of them specific to Obi (since Colliders are part of Unity, the ObiCollider component simply tells Obi to use a specific collider). Here's 3 different methods you can use:

- Put the collider in a specific layer, then in your code check whether the collider is part of that layer or not. This is probably the simplest method but also the most cumbersome to use.
- Send a raycast downwards from the position of your softbody, see if it hits any collider to determine whether there's something directly below it.
- Check the contact normal of the surface you're colliding against, and calculate its slope to determine whether it's horizontal ground or something else.

let me know if you need further help,

kind regards
Reply