Massive performance decrease when moving btGhostObject

Post Reply
fsxfreak
Posts: 10
Joined: Mon Sep 03, 2012 12:09 am

Massive performance decrease when moving btGhostObject

Post by fsxfreak »

I'm trying to utilize btPairCachingGhostObject as a triangle cast to detect objects in front of my object of interest. It is working, however there is a massive performance impact when I move the ghost manually, like so:

Code: Select all

mTriangleGhost->setWorldTransform(btTransform(mNode->getOrientation(), mNode->getPosition()));
I initialize the ghost like so:

Code: Select all

btTriangleShape *triangleCast = new btTriangleShape(btVector3(0, 0, 0), btVector3(100, 0, 250), btVector3(-100, 0, 250));
    mTriangleGhost = new btPairCachingGhostObject();
    mTriangleGhost->setWorldTransform(btTransform(rotation, carPosition));
    mTriangleGhost->setCollisionShape(triangleCast);
    mTriangleGhost->setCollisionFlags(mTriangleGhost->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);

    mDynamicsWorld->addCollisionObject(mTriangleGhost, btBroadphaseProxy::SensorTrigger, btBroadphaseProxy::AllFilter & ~btBroadphaseProxy::SensorTrigger);
Is there any specific reason why using setWorldTransform() would incur a massive performance impact? When not moving the object at all, the framerate increases dramatically.

Side question: is it more effective performance wise to use multiple raycasts or just a triangle cast?
Post Reply