Arcanor
11-04-2007 10:25:22
I'm having trouble implementing a ray cast. Here's how I'm doing it:
When I run my code I get a memory access violation pointing to the CollisionRayCast function in ogrenewt_tools.cpp:
Can anyone tell me what's wrong with my code, or provide a code snippet?
By the way, is there a repository of code snippets somewhere? I looked through the API documentation for both Newton and OgreNewt, the OgreNewt demo sample sources, and the StuntPlayground source as well and couldn't find any usage example.
Thanks in advance.
bool ArcObject::isOnGround(void)
{
Ogre::Vector3 Norm;
Ogre::Vector3& rNorm = Norm;
int ColID;
int& rColID = ColID;
Ogre::Real retval = OgreNewt::CollisionTools::CollisionRayCast(mBody->getCollision(), Ogre::Vector3::ZERO, Ogre::Vector3::NEGATIVE_UNIT_Y, rNorm, rColID);
return (retval < 1);
}
When I run my code I get a memory access violation pointing to the CollisionRayCast function in ogrenewt_tools.cpp:
Ogre::Real CollisionRayCast( const OgreNewt::Collision* col, const Ogre::Vector3& startPt, const Ogre::Vector3& endPt,
Ogre::Vector3& retNorm, int& retColID )
{
return NewtonCollisionRayCast( col->getNewtonCollision(), &startPt.x, &endPt.x, &retNorm.x, &retColID );
}
Can anyone tell me what's wrong with my code, or provide a code snippet?
By the way, is there a repository of code snippets somewhere? I looked through the API documentation for both Newton and OgreNewt, the OgreNewt demo sample sources, and the StuntPlayground source as well and couldn't find any usage example.
Thanks in advance.