Raycast Car - how to control a car

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Raycast Car - how to control a car

Postby to_masz » Thu Aug 19, 2010 10:45 am

I've read "Tutorial_203_RayCastConvexCastCar" and have found there a great piece of code. But I'm also interested in adding simple controller to my car. I'm using dJointLibrary_d.dll with uncommented DGRaycastVehicle functions.

I've decided to start with wheel steering. My function changes the angle parameter and then it uses:
DGRaycastVehicleSetCustomTireSteerAngleForce(carJoint,angle,0.0f);

I run my project and everything works fine, till the car speed is not 0. If its speed reached 0, my function stops working.

Have you got any solution for this issue? Should I initiate something before steering wheels? Can you give me working example of good using this function?
I will be very thankful for any help.
to_masz
 
Posts: 4
Joined: Thu Aug 19, 2010 3:09 am

Re: Raycast Car - how to control a car

Postby PJani » Thu Aug 19, 2010 10:56 am

probably autosleep is on? just when you create body set autosleep to 0. It should work. Uncommented?, does that even work?
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Raycast Car - how to control a car

Postby to_masz » Thu Aug 19, 2010 12:27 pm

It looks like I copied original dJointLibrary_d, which comes with Newton SDK, not that one compiled by myself ;)

@PJani, thank you, it works! But I use it only with car body. Should I edit CustomDGRayCastCar.cpp and set autosleep 0 to tires?

But now I have another problem. I was trying to set tire torque.
In first situation car falls down, hits the slope, jump and wheels start rotating, car hits the ground again and wheels stop rotating.
When I put the car on the ground, wheels rotate but not as the reason of tire torque. They rotate like in tutorial. It seems, there is no traction (another problem here).

Can you give me any ideas?
to_masz
 
Posts: 4
Joined: Thu Aug 19, 2010 3:09 am

Re: Raycast Car - how to control a car

Postby PJani » Thu Aug 19, 2010 12:45 pm

in DGRayCastCar i dont know completely how are tires connected to body if they are connected by joint then you dont have to set autosleep of tires to 0. But if otherwise then you will have to set autosleep manualy to 0.

Dont tell me about traction :D. I have so much problems with multibody vehicle, i have NONE traction. :D :D :D.

I dont think you have problem with traction because if your car jumps you have maybe to high suspension stiffness or...
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Raycast Car - how to control a car

Postby to_masz » Thu Aug 19, 2010 1:15 pm

Can anybody tell me how to change the code from "Tutorial_203_RayCastConvexCastCar" in order to get the normal car traction?
to_masz
 
Posts: 4
Joined: Thu Aug 19, 2010 3:09 am

Re: Raycast Car - how to control a car

Postby Stucuk » Thu Aug 19, 2010 5:43 pm

See This Post. Its a known problem with the Raycast Vehicle.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Raycast Car - how to control a car

Postby to_masz » Fri Aug 20, 2010 3:14 am

It's better - thank you ;)
But still the car has a very low traction. It behave like on ice, not like on road :(
to_masz
 
Posts: 4
Joined: Thu Aug 19, 2010 3:09 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 203 guests