You have forget the vehicle modeler too ?
I indeed found the nice impreza googling the open space of internet and have not done it myself
very fast car!! are you updating the physics "faaster" than realtime? everything feels slightly faster than real life (gravity, etc).
What I'm always missing in racing games is the actual feeling of speed so that is what I wanted to achive. The best way I could do it was by updating Newton twice every render which is ofcourse not a good idea for performance. For some reason two updates with timestep of 0.03 does not give even close the same results as one update with timestep of 0.06 - am I missing something? FPS is simply limited to 60 and Newton updated twice with a constant timestep. I'm sure this is not the best way so I'm open for suggestions:
- Code: Select all
int fpslimiter = 0;
while(game->isRunning())
{
if(game->isWindowActive())
{
if(game->getTickCount() - fpslimiter >= 16)
{
fpslimiter = game->getTickCount();
game->updatePhysics(0.03);
game->updatePhysics(0.03);
game->updateSound();
game->startScene();
game->renderGraphics();
game->render2D();
game->endScene();
game->parseInput();
}
}
}
Car gravity constant is not 9.8 either, I came up with 15 by testing - jumping with the car and changing the value until the jump looked real for the eye. Additionally a bit of downforce is added to the gravity based on another fictional constant and car speed:
- Code: Select all
force[1] = -mass * 15.0f + avg_speed * 5.0f;
The driveshaft has automated clutch, engine drag, wheel drag and speed drag (missing time delay between gear shifts.
The coeficents are calculated as follows and probably doesn't have too much to do with real physics either, just seemed to work ok. Any ideas for them are welcome:
- Code: Select all
float use_load = fabs(load) <= 10000 ? fabs(load) : 10000;
float use_speed = fabs(speed) <= 100 ? fabs(speed) : 100;
float slc = use_speed*0.1/(((9999-use_load)/10000));
NewtonVehicleSetTireSideSleepCoeficient(vehicle, id, slc);
NewtonVehicleSetTireLongitudinalSlideCoeficient(vehicle, id, load * grip * fabs(speed));
// (where 1 < grip < 3)
One recommendation. If you add a delay between the camera matrix and the vehicle matrix, it will be possible to see all the movement of the vehicle frame. Now it is too rigid and it is like a FPS camera but in third person.
It is very easy to make a camera like that.
I have tried to do it and searched for it but with little success. I'm new with matrixes and 3d algebra so it would be great if someone could help me with the camera - it would indeed be nice to see the side of the car while powersliding and such. My current (messy) camera code:
- Code: Select all
f32 camZoom = 5;
core::vector3df camDist = core::vector3df(0,0.35f,1.0f) * camZoom;
core::vector3df camRot(0,90,0);
core::matrix4 rotation;
rotation.setRotationDegrees(camRot);
rotation.rotateVect(camDist);
core::matrix4 transformation = truck->node->getAbsoluteTransformation();
transformation.transformVect(camDist);
camNode->setTarget(transformation.getTranslation());
camNode->setPosition(camDist);
Thanks for the support and great physics engine! I remember Julio mentioning axes in the future, looking forward to new features