Hello. I am a new game developer, I started developing a few months ago, and I decided to try and make a racing game. I am using bullet for my vehicle physics, but I have a small problem. I want to make a button which will allow you to select a new vehicle, but I want the current vehicle to be destroyed. I am using RaycastVehicle, and I have bullet physics engine integrated with another engine. So far I tried this:
Code: Select all
Model *player = GetTargetNode();
BulletScene *rootScene = static_cast<BulletScene *>(TheBulletExtrasPlugin->GetRootScene(GetTargetNode()->GetWorld()->GetRootNode()));
btDiscreteDynamicsWorld *dynamicsWorld = rootScene->GetDiscreteDynamicsWorld();
if(player->FindNode("Chassis"))
{
body->setActivationState(WANTS_DEACTIVATION);
dynamicsWorld->removeRigidBody(body);
dynamicsWorld->removeVehicle(vehicle);
}
Some of the functions might be from C4 though, but I hope you might get an idea what I have done so far. With this code, when I run it the car stops moving, I cant move at all, although the game does not crash, it doesn't do anything, but my model(car) is still there... what else can I try to do?