Page 1 of 1

Trouble with ray testing

Posted: Sun May 28, 2017 4:52 pm
by aFerreira
Hello,

I am trying to implement a player controllable character using a btRigidBody, and im having trouble with using ray testing to determine if the character can/cannot jump. The issue is that the following error appears when trying to perform the rayTest:
"Overflow in AABB, object removed from simulationIf you can reproduce this, please email bugs@continuousphysics.com
Please include above information, your Platform, version of OS.
Thanks."

The function for the ray testing is the following:

Code: Select all

void humanoid::rayCastForJumping (void)
{
        btTransform xform;
    	m_humanoidRigidBody->getMotionState()->getWorldTransform (xform);
    	btVector3 down = -xform.getBasis()[1];
    	down.normalize ();

        btVector3 raySource, rayTarget;

    	raySource = xform.getOrigin();
    	rayTarget = raySource + (down * m_height/2.0 * btScalar(1.1));

        btCollisionWorld::ClosestRayResultCallback ray(raySource, rayTarget);
        m_ownerWorld->rayTest(raySource, rayTarget, ray);

        if (ray.hasHit())
        {
            const btRigidBody* hit = btRigidBody::upcast(ray.m_collisionObject); // find what the ray hit

            if(hit != m_humanoidRigidBody) // If the ray doesn't hit the player itself
            {
                m_rayLambda = ray.m_closestHitFraction;
            }
            else
            {
                std::cout<<"Ray has hit the player collision box, please adjust parameters in humanoid ray cast"<<std::endl;
            }
        }
        else
        {
            m_rayLambda = 1.0;
        }

}
I have isolated the issue to

Code: Select all

m_ownerWorld->rayTest(raySource, rayTarget, ray);
but unfortunately this is the function that performs the actual ray test and its not evident (to me) from the error what is wrong. Also the character uses a capsule for collision detection purposes.

Can you guys help me, or at least point me in the right direction? If you need anything else please ask. Thanks in advance.