ClosestConvexResultCallback members?Could someone explain ?

Post Reply
singularPoint
Posts: 6
Joined: Wed Aug 08, 2012 7:24 pm

ClosestConvexResultCallback members?Could someone explain ?

Post by singularPoint »

Hello

Could someone please explain the meaning and role of the members of ClosestConvexResultCallback?
I would like to understand what the following parameter mean:

btScalar m_closestHitFraction;

btVector3 m_convexFromWorld;
btVector3 m_convexToWorld;
btVector3 m_hitNormalWorld;
btVector3 m_hitPointWorld;
btCollisionObject* m_hitCollisionObject;

Thank you!
trollington
Posts: 8
Joined: Thu Nov 24, 2011 3:08 pm

Re: ClosestConvexResultCallback members?Could someone explai

Post by trollington »

btVector3 m_convexFromWorld;
btVector3 m_convexToWorld;
These are the origin and destination of your convex cast/sweep
btVector3 m_hitPointWorld;
World coordinates of the detected hit point
btVector3 m_hitNormalWorld;
Normal of surface that was hit (if the surface is the floor, this is a vector pointing up)
btScalar m_closestHitFraction;
This is a number between 0.0 and 1.0 where 0.0 is origin and 1.0 is destination. If the hit fraction is 0.33333, it means hitPointWorld is located 1/3 of the way between convexFromWorld and convexToWorld
btCollisionObject* m_hitCollisionObject;
Pointer to the collision object that was hit
Tau
Posts: 25
Joined: Tue May 01, 2012 11:52 am

Re: ClosestConvexResultCallback members?Could someone explai

Post by Tau »

I just wanted to start similar topic so i hope i can ask here.
I have problems with m_hitPointWorld, if the ray hit an object m_hitPointWorld doesn't return the hit point but (0, 0, 0). What am i doing wrong?
singularPoint
Posts: 6
Joined: Wed Aug 08, 2012 7:24 pm

Re: ClosestConvexResultCallback members?Could someone explai

Post by singularPoint »

Thank you trollington,

Ill make sure ill put your explanation on the bullet wiki under definitions so people won't go trough the same hassle as i went.

Tau, when i had raycasting issues, visualizing the ray was very helpful in checking if the raycasting is supposed to give me an hit point or not. For sweeping you might need to do a similar thing.
Also you might need to check if the filter mask of the objects you are checking the casting against accept collision checking.

It is also true that often bullet will not detect the the ray/sweep collision points with valid objects when the length of the ray path is very short.
In my case when I move my ghost character in small but clearly visible steps the convex sweep and the ray casting that are done between steps do not detect collisions although collisions clearly happen. For normal steps the same algorithm does detect collision. When i'm talking about visible steps consider that the height of my character is 13 units and my display port is 640x480.

Hope this helps,
Cheers
Tau
Posts: 25
Joined: Tue May 01, 2012 11:52 am

Re: ClosestConvexResultCallback members?Could someone explai

Post by Tau »

Bullet detects collision for me, i get m_hitNormalWorld and m_closestHitFraction. I can use them but i also need m_hitPointWorld.
Never mind, i think i can use m_closestHitFraction to calculate hit point.
Also thanks trollington for explanation of m_closestHitFraction.
Post Reply