Jump to content

[SOLVED] Using getContact*


photo

Recommended Posts

Hello,

 

I've searched the entire samples etc. for any example of how to use the getContactDepth, getContactNormal, etc. methods.

 

However, there is only one sample: callbacks_02.cpp which doesn't actually use or do anything with the result of the functions.

 

I am currently attempting to scale the contact normal by the contact depth, and translating the colliding body by that vector. This doesn't seem to work. Contact depth tends to be an extremely small value.

 

What exactly is contact depth? Is it the depth by which the body has penetrated the other?

What about getContactTime? It seems to always return 0.

 

 

 

 

Michael Zhang

Link to comment

I have gotten to the contactNormal and contactDepth resolution approach to work. I was making a mistake in a transformation into a different space (the space in which movement is defined for my character).

 

Still interested in why getContactTime is always 0.

 

Or, general information regarding smooth natural looking contact resolution, since waiting on contact collision before moving it back causes this sort of stuttering effect.

Link to comment

getContactTime() is for CCD only. It returns the time between the current physics simulation tick (that would be the zero time point) and the moment when a sphere or a capsule hit an obstacle (between physics ticks). For noncontinuous collision detection 0 is always returned.

 

Contact depth is simply how far the body has penetrated an obstacle along the contact normal (measured in units).

Link to comment

Well, I am using a Capsule with the Continuous checkbox checked in the node editor.

Still getting contactTime = 0 when I respond to a contact callback.

Link to comment
Still getting contactTime = 0 when I respond to a contact callback.

 

Michael, not sure, but might be related to the fact that you are handling contact data evaluation not directly within contact callback triggered from asynchronous physics thread but at a later point in time within world update/flush()

Link to comment
×
×
  • Create New...