Collision handling along a specific axis.

Post Reply
Vitulus
Posts: 5
Joined: Thu Dec 20, 2018 10:55 am

Collision handling along a specific axis.

Post by Vitulus »

Hello,
I have my own custom character controller. However, I found some issues that would easily be fixed if I could change an axis collision handling can work in. From my understanding Bullet Physics moves your character in the direction of the face normal of what you have collider with. However, I do not want this. For example, I want if the character collides with a triangle which normal is upwards, I want the collision handler to only move the character upwards to solve the constraint. However, if a triangle normal is not upwards then I want the collision handler to only move the character on the X and Y axis.
This can be worked by changing

Code: Select all

setLinearFactor()
in the rigidbody, however, this also affects velocity and I want the response to change per triangle. I don't want to write my own handler - which is the reason I turned to bullet, there must be someway to slightly change it like this.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Collision handling along a specific axis.

Post by drleviathan »

I don't know of an easy one-liner or config change for achieving what you want. You would have to catch, check, and potentially modify each added contact point via a custom callback. Alternatively, you might be able to get the behavior you want by adding custom logic to your CharacterController: it could use a ray test to determine the normal directly under it and then constrain its velocity accordingly.
Vitulus
Posts: 5
Joined: Thu Dec 20, 2018 10:55 am

Re: Collision handling along a specific axis.

Post by Vitulus »

I don't want to constrain the velocity only the colliders velocity. I'll see about a custom callback
Post Reply