Implemeted Raycast Vehicle In Irrbullet Some More Help

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.

Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby mubashar » Fri Dec 30, 2011 5:43 pm

Hello Everyone

well i am a bit happy to tell you i have almost implemented Raycast vehicle using IrrBullet :). But :( still having some problems i am facing right now if you can fix this or at least help me in doing this its good start for my big project and first complete raycast vehicle example in IrrBullet i am hoping to get your good response from community. :D

W
Handling A S D Keys

Image

Please take a look at these issues

1: Tweaking With Handling parameters (natural steering)
2: tires are half under the plane (plz fix this or any hint why it is happening)
3: when moving fast it starts shaking
4: gravity is behaving very unnatural
5: sometimes it start slipping don't know why
6: optimization with car and wheel parameters. if possible

here is the complete code VS 2008 and media
http://www.MegaShare.com/3821197
When it's all over, it's not who you were. It's whether you made a difference
User avatar
mubashar
 
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby randomMesh » Fri Dec 30, 2011 6:25 pm

eForce=50000.0f;

scar = new IGImpactMeshShape(carNode,smgr->getMesh("media\\car\\phy.b3d"),12000.0); // Tweak with mass a bit

Bullet uses SI units, so the mass of the car and the applied forces are way too huge. You should read this.

And i quote the Bullet User Manual:
Simulation becomes unstable when a heavy object is resting on a very light object. It is best to keep the
mass around 1.


Btw:
Why 3 main.cpp? It's really confusing. :)
"In fact, nearly every sequence of punctuation is used for something in Perl. So, if you get writer’s block, just let the cat walk across the keyboard, and debug the result."

Katastrophe - A free, open source flocking boids simulation
User avatar
randomMesh
 
Posts: 1138
Joined: Fri Dec 29, 2006 12:04 am

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby mubashar » Fri Dec 30, 2011 6:51 pm

@randomMesh thanks for quick reply i know its bit confusing and random code not managed very well. but still my goal is to implement raycast vehicle than re code and refine. So it means i have to place some heavy object on plane like track ?? and also decrease cars mass value?
When it's all over, it's not who you were. It's whether you made a difference
User avatar
mubashar
 
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby serengeor » Fri Dec 30, 2011 8:38 pm

mubashar wrote:So it means i have to place some heavy object on plane like track ?? and also decrease cars mass value?

Have you even read the link he gave you?

AFAIK the "Track" should not have any mass (it's not going to fall now, is it?), it's a static object meaning mass should equal 0. On the other hand the car mass should be tweaked. You should probably write a GUI that would let you use some sliders/scrollbars to tweak every parameter and find which ones you are most comfortable with. Tweaking them in code would be very time wasteful if you don't know how things should go.
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby mubashar » Sat Dec 31, 2011 6:26 am

@serengeor man its quite confusing :( like
Simulation becomes unstable when a heavy object is resting on a very light object. It is best to keep the
mass around 1.
if track mass is 0 and yes its static object how to surpass this restriction :( ???
When it's all over, it's not who you were. It's whether you made a difference
User avatar
mubashar
 
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby serengeor » Sat Dec 31, 2011 12:44 pm

mubashar wrote:@serengeor man its quite confusing :( like
Simulation becomes unstable when a heavy object is resting on a very light object. It is best to keep the
mass around 1.
if track mass is 0 and yes its static object how to surpass this restriction :( ???


The mass of a road/track/world/level or w/e you call it should be 0, and the car mass should be a lot lower than now. I can't say exactly how much it should be because as I said before, you should write a gui and tweak every value until you find it work good for you. Then you can write those values down and hard code them in, or put them in some sort of settings file.
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby RdR » Sat Dec 31, 2011 1:25 pm

By default, Bullet assumes units to be in meters and time in seconds, so if the models are scaled correctly to that format you can use real life mass and force.
If not, I recommend to scale everything to meters (your model size), it saves alot of tweaking trouble (Scaling the world)
For example the car should have a mass around 1200kg instead of 12000kg.


Ferrari 360

Dimensions:
Overall: length 4,477 mm (176.3 in)
Overall: width 1,922 mm (75.7 in)
Height: 1,235 mm (48.6 in)
Wheelbase: 2,600 mm (102.4 in)
Front track: 1,669 mm (65.7 in)
Rear track: 1,617 mm (63.7 in)
Weight: 1,350 kg (2,976 lb)
Curb weight: 1,450 kg (3,197 lb)
Weight distribution: 42/58% front/rear
Fuel capacity: 95 L (25 US gal; 21 imp gal)


http://en.wikipedia.org/wiki/Ferrari_360

Also take a look at stepping the world

For TANK@WAR we use the following (Client side):
cpp Code: Select all
 
stepSimulation(deltaTime * 0.001f, 7);
 


EDIT:
Took a quick look in your code and following catched my eye:
cpp Code: Select all
 
carTirebr = smgr->addAnimatedMeshSceneNode(smgr->getMesh("media\\car\\tire.3ds"),carNode,2,vector3df(carNode->getJointNode("back_right_joint")->getPosition().X,carNode->getJointNode("back_right_joint")->getPosition().Y,carNode->getJointNode("back_right_joint")->getPosition().Z));
 


You can use getPosition() right away, instead of using XYZ and put it in a new vector3df
cpp Code: Select all
 
carTirebr = smgr->addAnimatedMeshSceneNode(smgr->getMesh("media\\car\\tire.3ds"),carNode,2,carNode->getJointNode("back_right_joint")->getPosition());
 


Its not wrong but it makes your code less readable.
User avatar
RdR
Competition winner
 
Posts: 257
Joined: Tue Mar 29, 2011 2:58 pm

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby mubashar » Sat Dec 31, 2011 6:09 pm

@serengeor and @RdR thanks for replying i have tweaked it a bit please take a look i have imported a demo track and set its mass 0 and cars mass 1 gravity 9.8 now tires are no more under the plane and also vehicle is behaving more natural still some parameters needs to be tweaked. like i am unable to implement natural steering ... setbrake method not working for me i am using alternative also how can i use two key pressed events combined like Forward + Left etc. also now i am unable to accelerate the vehicle even i have applied greater force but it accelerates fast when i set frictionslip to greater value but car backside start floating in air... one major issue how can i set tires position with respect to chesi so it moves and bounces like natural cars ...

specially check these parameters

cpp Code: Select all
 
rcar->setDamping(0.6f, 0.6f);
rcar->setFriction(0.01f);
 
///////
 
 info.suspensionStiffness = 200.0f;
 info.wheelDampingRelaxation = 2.3f;
 info.wheelDampingCompression = btSqrt(0.2f * 2.3f * 200.0f);
 info.frictionSlip = 2.0f;
 info.rollInfluence = 0.2f;
info.maxSuspensionTravelCm = 20.0f;
info.wheelSuspensionForce = 6000.0f;
vehicle->updateWheelInfo(i);
 
/////////////
 
wheel.wheelDirectionCS = irr::core::vector3df(0.0, -1.0, 0.0);
wheel.wheelAxleCS = irr::core::vector3df(-5.0, 0.0, 0.0);
wheel.suspensionRestLength = 0.100f;
wheel.wheelRadius = 7.564f;
 
 


Image

please can you take a look at this updated version

http://www.megashare.com/3824930
When it's all over, it's not who you were. It's whether you made a difference
User avatar
mubashar
 
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Implemeted Raycast Vehicle In Irrbullet Some More Help

Postby RdR » Sat Dec 31, 2011 8:35 pm

To handle multiple keys take a look at this example: http://www.irrlicht3d.org/wiki/index.ph ... ntReceiver
User avatar
RdR
Competition winner
 
Posts: 257
Joined: Tue Mar 29, 2011 2:58 pm


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest