BigB
04-06-2008 22:01:10
Hi,
I'm tryng to get a vehicle working in NxOgre.
Following some examples i found in this forums, i was able to get it on screen, accelerate and move the wheels, however he doesn't move from the same place.
I spawn the vehicle a bit in the air, and he falls until he stops on a plane.
After that, i just press the keys to accelerate, steer, i see the wheels steering, i see the wheels rotating when i accelerate, but he doens't move.
Here's my setup :
Then, in the Listener, my input :
Can anyone help me ?
thanks
I'm tryng to get a vehicle working in NxOgre.
Following some examples i found in this forums, i was able to get it on screen, accelerate and move the wheels, however he doesn't move from the same place.
I spawn the vehicle a bit in the air, and he falls until he stops on a plane.
After that, i just press the keys to accelerate, steer, i see the wheels steering, i see the wheels rotating when i accelerate, but he doens't move.
Here's my setup :
car = pmScene->createBody("car", new NxOgre::Cube(2,2,3), Vector3(6, 26, 6), "model: buggy.mesh , material: Examples/OffsetMapping/Specular", "mass: 1500");
car->setRenderMode(RenderableSource::RM_Interpolate);
// Set up the Params for all of the wheels.
WheelParams wp;
wp.setToDefault();
wp.mLocalPose.t.set(0.756, 0, 1.319);
wp.mSuspension.damper = 0.2f;
wp.mSuspension.spring = 25000.0f;
wp.mSuspension.targetValue = 0.0f;
wp.mSuspensionTravel = 0.3f;
// Create the wheels.
mSet = WheelSet::createFourWheelSet(0.45f, float3(0.756, 0, 1.319), float3(-0.756, 0, -1.076), car, wp, "model: tyre.mesh, material: Examples/OffsetMapping/Specular, mode: interpolate");
// Set the wheels as front wheel drive.
mSet->setAs(WheelSet::TL_Front);
car->setSleepEnergyThreshold(0.0);
car->wakeUp(1e10);
Then, in the Listener, my input :
if(mKeyboard->isKeyDown(OIS::KC_T))
{
mSet->drive(20000);
mSet->brake(0);
}
else
if(mKeyboard->isKeyDown(OIS::KC_G))
{
mSet->brake(25);
mSet->drive(0);
}
else
{
mSet->drive(0);
}
if (mKeyboard->isKeyDown(OIS::KC_F))
{
mSet->steer(0.75);
}
else
if (mKeyboard->isKeyDown(OIS::KC_H))
{
mSet->steer(-0.75);
}
else
{
mSet->steer(0);
}
Can anyone help me ?
thanks