si
03-05-2008 11:48:08
I'm trying to use a basic rayCast to detect whether a projectile has hit anything in my scene. This is how i'm using it
However when the function returns I get the following error
Run-Time Check Failure #2 - Stack around the variable 'hitRay' was corrupted
I'm currently using Visual C++ V9.0 (2008), Ogre3D V1.4.7, Newton 1.53 and OgreNewt 0.10.
Has anyone else encountered this problem?
Thanks
OgreNewt::BasicRaycast hitRay(BaseApplication::getSingletonPtr()->GetWorld(), pos, nextPos );
OgreNewt::BasicRaycast::BasicRaycastInfo info = hitRay.getFirstHit();
for(int i =0; i< hitRay.getHitCount(); i++)
{
//Returns all the object we have hit one at a time
info = hitRay.getInfoAt(i);
if(info.mBody)
{
OgreNewt::Body *body = (OgreNewt::Body *)info.mBody->getUserData();
{
CCollisionPacket P;
P.m_Position = pos + ((nextPos - pos) * info.mDistance);
P.m_Normal = info.mNormal;
P.m_Damage = 50.0f;
CEntity *object = (CEntity*) body;
//Tell object we have collided
object->OnCollision(&P);
hit = true;
}
}
}
However when the function returns I get the following error
Run-Time Check Failure #2 - Stack around the variable 'hitRay' was corrupted
I'm currently using Visual C++ V9.0 (2008), Ogre3D V1.4.7, Newton 1.53 and OgreNewt 0.10.
Has anyone else encountered this problem?
Thanks