Ray/convex-cast vehicle WIP demo

Share with us how are you using the powerrrr of the force

Moderator: Alain

Ray/convex-cast vehicle WIP demo

Postby kallaspriit » Sun Jul 25, 2010 6:39 am

Little demo of my work-in-progress ray and convex cast vehicle [download].

My method works for any number of contacts per tire (the available force and load is divided by them) and I've implemented three types of tire contact sources (where the tire meets the ground and other objects):

1. simple raycast - casts 3 rays under the car, divided on the width of the tire.
4.jpg
Simple ray-cast
4.jpg (245.55 KiB) Viewed 13823 times


2. circular raycast - casts 3 rays horizontally and 8 circular around the tire, green lines (so not only collisions from under the tire are found)
3.jpg
Circular ray-cast
3.jpg (233.81 KiB) Viewed 13823 times


3. convex cast - casts cylinder the size of the tire towards under the car, finds all contacts with the ground
1.jpg
Convex-cast
1.jpg (246.82 KiB) Viewed 13823 times


Convex-cast only works for objects under the car, so I'm considering trying finding bodies near the tire and finding the constants using collision-collide.

Everything is pluggable (models for tire, spring, damper, visualizers, contact sources etc). I've implemented pacejka tire model (combining of forces is not complete).

For every contact, I have found/calculated the following:
- positions of tire contacts with the ground
- penetration
- load force
- lateran and longitudunal directions
- lateral and longitudinal forces
- lateral and longitudinal velocities
- max lateral force
- max longitudinal force
- current roll
- slip angle
- slip ratio
- camber

Right now, every contact forces are applied by a different joint object between the frame and NULL that are recreated every time tire becomes airborne-touches the ground again and when rolling on a new body, but I'm considering one joint per tire. Is there any limit to the amount of linear rows I can add in one joint?

I tried creating the joints between the frame and the body that the tire is on, but NGD went crazy for some reason. This would be good so for example when braking on a moving not-too-heavy body, the body would start slipping on the ground, same with lateral and longitudinal forces.

An UML diagram of current setup:
Image

Most important buttons for the demo:
- arrows to move around
- hold left shift to use more power to accelerate and also to brake
- F1 to toggle displaying debug graphics
- F2 to toggle physics pause
- F5 to toggle car chase mode
- F8 to toggle contact source (convex-cast, circular ray-cast, simple ray-cast)
- F9 to hide debug arrows of the car
- END to toggle car reverse
- hold left ctrl to pick objects with mouse
kallaspriit
 
Posts: 216
Joined: Sun Aug 14, 2005 6:31 pm

Re: Ray/convex-cast vehicle WIP demo

Postby Slick » Sun Jul 25, 2010 9:33 pm

Nice. How well does it scale for each type? Have you done a stress test? Can you do say 50 vehicles for example?
Slick
 
Posts: 330
Joined: Sat Feb 07, 2004 7:24 pm
Location: LA last and France now

Re: Ray/convex-cast vehicle WIP demo

Postby kallaspriit » Mon Jul 26, 2010 8:25 am

Have not stress-tested it yet, will get to that soon, I'm still considering some rather big changes to the architecture :)
kallaspriit
 
Posts: 216
Joined: Sun Aug 14, 2005 6:31 pm

Re: Ray/convex-cast vehicle WIP demo

Postby NewLife » Tue Oct 05, 2010 9:18 pm

very interesting. how is going your project? are you still working on it?
can you explain better the convex cast cilynder method please? i would like to implement in my driving game.

michele
NewLife
 
Posts: 2
Joined: Sun Oct 03, 2010 4:17 pm

Re: Ray/convex-cast vehicle WIP demo

Postby JernejL » Wed Oct 06, 2010 3:42 am

NewLife wrote:very interesting. how is going your project? are you still working on it?
can you explain better the convex cast cilynder method please? i would like to implement in my driving game.

michele


A typical old style tire simulation will be a simple raycast tire point, newton supports "convex cast" where you cast a shape against another shape (a cylinder against the ground surface for example), this can be used to calculate more exact tire ground contact patch and simulate several points on that tire contact patch, resulting in better simulation.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Ray/convex-cast vehicle WIP demo

Postby NewLife » Wed Oct 06, 2010 11:40 am

Delfi wrote:
NewLife wrote:very interesting. how is going your project? are you still working on it?
can you explain better the convex cast cilynder method please? i would like to implement in my driving game.

michele


A typical old style tire simulation will be a simple raycast tire point, newton supports "convex cast" where you cast a shape against another shape (a cylinder against the ground surface for example), this can be used to calculate more exact tire ground contact patch and simulate several points on that tire contact patch, resulting in better simulation.


i understand.. currently im using raycast sim and im searching for something more accurate... im using unity (based on ageia PhysX) that doesnt seem to support convex cast but only capsule cast and sphere cast. so im searching for another solution, for example cast several rays, starting from a ray normal to the ground surface (90 deg) to a ray 60 deg respect of the surface. do you think this is a good solution?
And what about using the "swept test" like told here (http://www.bulletphysics.org/Bullet/php ... &f=&t=1817)?
NewLife
 
Posts: 2
Joined: Sun Oct 03, 2010 4:17 pm

Re: Ray/convex-cast vehicle WIP demo

Postby JernejL » Wed Oct 06, 2010 3:15 pm

You mean using a rigid body? you can do that and control the friction in material callback.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia


Return to User Gallery

Who is online

Users browsing this forum: No registered users and 11 guests

cron