I am drawing a very small line that follows my player for the purposes of these raycast collisions against specific objects.
No matter the distance from the player (and therefore the line) the object I am checking against is the getSceneNodeFromRayBB function is returning it when it passes the projected path of the ray.
Debug values from the ray and box themselves show there is no collision, and checking the returned scenenode's transformed bounding box against the same line return false for intersect.
The object I am checking for does have a triangle selector that is created from its own bounding box. I get the feeling the getSceneNodeFromRayBB call isn't taking the object's transformation into account, although I have done raycast checks on other objects in the world that work properly.
For now I am able to use the aforementioned intersect check to continue, but it would be appreciated if anyone had insight to this issue.
Some code snippets:
Collision manager check
Code: Select all
void CollisionManager::SendRaycastCollision(line3df ray, GameObject* gameObj)
{
ISceneNode* sceneNode = nullptr;
GameObject* go = nullptr;
u32 t = 0xfffffff;
u32 bits = gameObj->GetType() ^ t; // To avoid colliding with itself
sceneNode = mpSceneCollisionManager->getSceneNodeFromRayBB(ray, bits); // this returns the object
bool collided = sceneNode->getTransformedBoundingBox().intersectsWithLine(ray); // this returns false
if(sceneNode)
{
go = mpObjectManager->GetObjectFromSceneNode(sceneNode);
}
if (go)
{
go->OnCollision(gameObj);
gameObj->OnCollision(go);
}
}
Code: Select all
void Powerup::Load(ISceneNode* node, eGameObjects type, EventManager* eventMan, ISceneManager* sceneMan,
ObjectManager* objMan, CollisionManager* colMan,
vector3df pos, vector3df rot, vector3df scl)
{
GameObject::Load(node, type, eventMan, sceneMan, objMan, colMan, pos, rot, scl);
mSceneNode->setName("Powerup");
ITriangleSelector* selector = mpSceneManager->createTriangleSelectorFromBoundingBox(mSceneNode);
mSceneNode->setTriangleSelector(selector);
mSelector = selector;
}