Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: driving game
PostPosted: Fri Oct 30, 2009 8:09 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
kester wrote:
The force is clamped after mass is factored in, so you are probably hitting the maximum suspension impulse limits (I've upped the 6000 limit to 100000).
I see... I'll take a look around there again. It seems a bit strange though to have an arbitrary limit at all, or is it for numerical stability, or some such? But thankfully the source is wide open, so it's easy to just change it at will :)

kester wrote:
It's good to know my notes are helping people. :-)
For sure they did! Unfortunately, bullet's classes and their behaviour aren't what you'd call "well documented". :?


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Fri Oct 30, 2009 8:51 pm 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
kester wrote:
...so you are probably hitting the maximum suspension impulse limits...
You were right! The 6000 cap was indeed the culprit. After upping it a bit the suspension parameters started behaving like expected.

EDIT: perhaps that's another thing to note in your document ;)


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Tue Nov 03, 2009 7:50 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
Now, I've tried my hand at the interpolation you posted. And there must be something wrong with... something. The result was much worse behaviour. Even more bumpy and jittery than before. I couldn't even manage to complete one curve on the track any more. :roll:

What I did I was overrode the vehicle raycaster class and also the call result class (to get to the shape part and triangle numbers, which the default implementation just throws away :( ). After observing the quite horrible behaviour, I traced out all the points and normals I got as input, and noticed that the hit point was actually outside the triangle! No wonder the barycentric and interpolation stuff went haywire...

On the other hand, since the behaviour got that much worse, I guess the resulting normal does play a big part in the behaviour of the suspension :)

I was thinking also, when overriding these things, it should also be possible to use a normal map and return a normal from that... a bit more math required though. Anyone tried that?


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Wed Nov 04, 2009 12:51 am 
Offline

Joined: Mon Dec 01, 2008 5:08 am
Posts: 27
It seems weird that you're getting coordinates outside the triangle. I'm using btBvhTriangleMesh shape, and I get valid positions.

tatsujin wrote:
I was thinking also, when overriding these things, it should also be possible to use a normal map and return a normal from that... a bit more math required though. Anyone tried that?


I haven't tried it, but you should be able to work out the UV coordinates and tangent space from the barycentric coordinates, and then transform into world space. The main advantage from modifying the normal is smoothing out the seams between triangle edges, so it'd only help that if your normals were continuous across edges.

It might be useful for an off-road game, or for when you drive outside the optimal parts of the track.


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Wed Nov 04, 2009 8:29 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
kester wrote:
It seems weird that you're getting coordinates outside the triangle. I'm using btBvhTriangleMesh shape, and I get valid positions.
Same here, the collision shape is a btBvhTriangleMeshShape that I feed using a btTriangleIndexVertexArray from a custom source. That same custom source is used for lookup of the triangles in the ray caster.
Hmm.... now that I mention it, when rendering, I have to offset the visible mesh by -4.52 on the y-axis to make it match the collision shape - yup, a real wtf, and something I'll have to resolve, sooner or later. The same probably applies to the ray cast result! Didn't think of that, until now... I'll have to try that :) Maybe it would be more correct to use the btTriangleIndexVertexArray instead (for positions)...

kester wrote:
The main advantage from modifying the normal is smoothing out the seams between triangle edges, so it'd only help that if your normals were continuous across edges.
Yup, that's something I'll have to do correctly as well... not yet complete. However, I was thinking if I add interpolation now when the normals are hard there should at least be no difference in behaviour :)

kester wrote:
It might be useful for an off-road game, or for when you drive outside the optimal parts of the track.
Yeah, I realise it's usefulness is quite limited and most probably not worth the effort :)


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Wed Nov 04, 2009 11:58 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
tatsujin wrote:
Maybe it would be more correct to use the btTriangleIndexVertexArray instead (for positions)...
Nope. Indeed that class is only a thin wrapper for the arrays supplied in the constructor... Hmmm


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Thu Nov 05, 2009 8:30 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
tatsujin wrote:
... I have to offset the visible mesh by -4.52 on the y-axis to make it match the collision shape ... The same probably applies to the ray cast result!
Right.
I tried the same tweak on the ray cast result, and voilà: the interpolation works. And it rocks!
The diference is huge, goddamit! Why aren't normals, and their interpolation, supported by Bullet itself? Thanks for dropping the hint ;)

I'm still no closer to the mystery why this offset hack is needed, however... it just shouldn't be... :(


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Fri Nov 06, 2009 2:32 pm 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
tatsujin wrote:
I'm still no closer to the mystery why this offset hack is needed, however... it just shouldn't be... :(
Turns out that in the beginning of time I had put a +4.5 translation on the Y axis on the generated terrain shape (much later a mesh loaded from file) and then efficiently forgot about it. :roll:

Btw, I've the track mesh is now written with smooth normals all over (previously only some of them were), and I'll say it again: it rocks! The difference is considerably not insignificant! :o

I vote for normal smoothing to be added to Bullet's btRaycastVehicle by default! ;)
(collision shapes need to support normals then also of course).


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Mon Nov 09, 2009 5:16 am 
Offline

Joined: Mon Dec 01, 2008 5:08 am
Posts: 27
It's good to hear that it's working!

Adding it by default to Bullet probably requires some quite invasive changes. It's quite a bit of work just for vehicle simulation. I think you'd only want to add it to the 'mesh' shapes: the bvh tri mesh shape, and the heightfield terrain shape.


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Mon Nov 09, 2009 8:10 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
kester wrote:
I think you'd only want to add it to the 'mesh' shapes: the bvh tri mesh shape, and the heightfield terrain shape.
Yeah, and it's probably only useful for ray cast vehicle-type things.


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Thu Dec 10, 2009 7:05 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
Btw, I created an enhancement "issue" for having support for normals in the collision shape(s).


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Tue Jun 08, 2010 9:28 pm 
Offline

Joined: Wed Jan 20, 2010 1:35 am
Posts: 13
I'm trying to create realistic simulations of very large and heavy vehicles - bulldozers, dump trucks, etc. Masses of 35 000 kg or so. I've had to bump up the max suspension force, and I've got a couple questions.
A) are there any repercussion for bumping this limit way higher?
B) are there any other limits I might run into?
thanks.....


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Wed Jun 09, 2010 1:19 am 
Offline

Joined: Wed Jan 20, 2010 1:35 am
Posts: 13
kester wrote:
Bullet sets the wheel contact normal in btVehicleRaycaster::castRay.

I derive from btVehicleRaycaster and override that method ...


How do you determine which vertices to use?
I assume the data must be somewhere in either the btRigidBody or the btVehicleRaycasterResult ?


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Wed Jun 09, 2010 3:30 am 
Offline

Joined: Mon Dec 01, 2008 5:08 am
Posts: 27
castRay performs a ray-cast, which returns the triangle index, part id, collision object, and hit position of the end of the ray.

You can use the triangle index to work out which vertices form the hit triangle.


Top
 Profile  
 
 Post subject: Re: driving game
PostPosted: Wed Jun 09, 2010 9:57 am 
Offline

Joined: Fri Jul 18, 2008 8:06 pm
Posts: 14
dakffyd wrote:
kester wrote:
Bullet sets the wheel contact normal in btVehicleRaycaster::castRay.

I derive from btVehicleRaycaster and override that method ...

How do you determine which vertices to use?
I assume the data must be somewhere in either the btRigidBody or the btVehicleRaycasterResult ?

Generally, since the vehicles are heavy & slow-moving, perhaps you'll get better result using rigid body wheels instead of ray cast.
In my own experiments, rigid body wheels have quite big advantages over raycast in terms of being realistic. But since things usually breaks apart physics-wise at high speed (rotations) and require more processing power, raycast usually is better suited for racing-type games... But your choice of vehicles implies that this is not racing :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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