Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Jan 08, 2008 4:27 pm 
Offline

Joined: Sun Jan 14, 2007 7:56 pm
Posts: 169
Location: Norway
Hi all,

I've implemented a vehicle model based on raycasts for the wheels. One ray per wheel, pointing down, just like in the bullet example vehicle. The game I'm working on needs some offroad and obstacle driving, so the ray is often not accurate enough. To make it worse, the wheels are in the open, so it would be nice to get collisions when something collides with the wheel (an Avatar, some boxes or whatever).

I'm considering various approaches to making this better. Creating wheels with cylinder rigibodies and connecting them to the chassis with constraints is not really an option, the constraints don't have any good options for suspension, and it's not accurate enough for normal fast road driving.

So, I'm now considering to use a cylinder collision shape instead of the ray to check for contact points, and generate my forces based on that. If any of you have already tried this, I'd be really grateful for any hints on how it worked out. What's the best way to do this in Bullet? I am thinking of something like to try to create a btCollisionObject and manually test for collisions against the physics world.

Best regards,
Ola


Top
 Profile  
 
PostPosted: Wed Jan 09, 2008 12:42 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
ola wrote:
Hi all,
So, I'm now considering to use a cylinder collision shape instead of the ray to check for contact points, and generate my forces based on that. If any of you have already tried this, I'd be really grateful for any hints on how it worked out.

Some big upcoming commercial game used this approach, using Bullet (confidentially so no mention which title). They use a sphere/convex cast for the wheels, and also for their character controller. They created a new convex shape, that approximates a wheel better then a sphere. We can add such shape to Bullet, but you could try the cylinder too. You need to filter/ignore some false collision hits, against walls etc.
Quote:
What's the best way to do this in Bullet? I am thinking of something like to try to create a btCollisionObject and manually test for collisions against the physics world.

I suggest trying out the 'swept' collision using btCollisionWorld::convexTest, you can choose a sphere or other convex shape. Check the ConcaveConvexcastDemo how to use this.

Hope this helps,
Erwin


Top
 Profile  
 
PostPosted: Mon Jan 14, 2008 10:17 am 
Offline

Joined: Sun Jan 14, 2007 7:56 pm
Posts: 169
Location: Norway
Hi Erwin,

that's excellent, thank you!

I'd be quite interested in that special wheel convex shape. I'd guess it's something like a "convex torus"? The cylinder might end up driving on it's edges all the time, so it might not be optimal. I'll try to use that first, anyway.

Best regards,
Ola


Top
 Profile  
 
PostPosted: Tue Jan 15, 2008 2:36 pm 
Offline

Joined: Sun Jan 14, 2007 7:56 pm
Posts: 169
Location: Norway
I'm a bit confused about the "swept test". In my case here I have a shape (the wheel) at some position in the world that I want to test against everything else. So I don't really need to sweep it as I have just one position. Should I then use the same transform twice in the function call, where the transform contains the position of the center of the wheel? Or maybe I have misunderstood the meaning of "sweep"?

example:
Code:
convexSweepTest(wheel_shape_, wheelpos, wheelpos, wheeltest_callback_);


By the way, the ConcaveConvexcastDemo doesn't compile with double precision, there's a problem with btScalar and GLfloat not being the same in that case:
Demos/AllBulletDemos/../ConcaveConvexcastDemo/ConcaveConvexcastDemo.cpp:203: error: cannot convert ‘btScalar*’ to ‘const GLfloat*’ for argument ‘1’ to ‘void glMultMatrixf(const GLfloat*)’

Best regards,
Ola


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group