Working vehicle simulation ("proof" implementation)

dudeabot

02-10-2011 16:57:36

Hello,

I am working on a driving simulator for my master thesis, so as the first step i started looking for existing examples and found this nice implementation of user "proof" viewtopic.php?f=6&t=14031

I have integrated and compiled it in one single visual studio project so other users may use it aswell.

NxOgre and critter Version: buggyswires

you can watch the video of it in action here:
http://www.youtube.com/watch?v=-evx87UDRgo

finally here is the project solution(VS 2008):
http://www.gjteam.com.br/vehicleMestrado.rar

lately I have been playing around with some values and watching the result.

Here is my todo list:

.Make the vehicle stop progressively when its not accelerating , right now the vehicle keeps sliding ad infinitum.
.Get the vehicle velocity (body->getLinearVelocity().magnitude will do?)
.Create some real road! :P
.Play with different values to represent other vehicles, not just sport cars

the great problem now, is that nxwheel is a blackbox class and its more like play and experiment thing..

Any help is appreciated :D

betajaen

02-10-2011 18:15:05

Very nice!

.Make the vehicle stop progressively when its not accelerating , right now the vehicle keeps sliding ad infinitum.

Play around with Friction; the Tire Description classes specifically. Possibly air resistance too; although it would be easy enough to model the car as sphere and just apply a force that way. Wikipedia/HyperPhysics will help you out.

.Get the vehicle velocity (body->getLinearVelocity().magnitude will do?)

Yep.

Ivancho

26-02-2012 12:34:39

Hi, it working well, but seems it rotating wrong...
Car use for steering rear wheels, but visually rotating front wheels.

any suggestions? should i upload youtube video?

using BuggySwires (Sparked) 1.7 and Ogre (Cthugha) 1.7.2

dudeabot

26-03-2012 10:57:00

have you solved you problem? im picking the vehicle implementation again, and will try to solve the remaining issues

sorry for the delay

Ivancho

08-05-2012 06:45:58

hi, solve rotation.

vehiclewheel.cpp
VehicleWheel::update
fix
z.FromEulerAnglesXYZ(Ogre::Radian(), Ogre::Radian(wheel->getSteeringAngle()-baseOrientation * Ogre::Math::PI/180), Ogre::Radian());

baseapplication.cpp
bool BaseApplication::frameRenderingQueued(const Ogre::FrameEvent& evt)
fix

if (mKeyboard->isKeyDown(OIS::KC_NUMPAD4)) {
vehicle->steerLeft();
}
if (mKeyboard->isKeyDown(OIS::KC_NUMPAD6)) {
vehicle->steerRight();
}


vehicle.cpp
Vehicle::Vehicle(std::string name, VehicleDescription vehDesc, Critter::RenderSystem* critter)
fix

wheels = new VehicleWheel(vehicleName, static_cast<Wheel*>(body->getShape(3-i)),
vehDesc.wheelPositions,
(i % 2 == 0) ? 0 : 180.0f, body->getNode()->getSceneNode());


this is dirty fixes, but at least it works.
thanks for demo.