Re: Vehicle configuration

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: dNewtonCollisionMesh problem

Postby e3dalive » Fri Feb 06, 2015 12:38 pm

I've reversed the winding order, that seems to fix the problem(i will test it more to be sure), thank you. I wonder why only the road didn't work, other models were fine, even if they had wrong winding order
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Fri Feb 06, 2015 12:43 pm

but it's still very strange that when i send box from above the ground it lags and road sends it into space

yes I saw that, that's why I think there maybe a double face. But I do not see any.
I will test that by modifying a demo to see what is going on, but it have to be tonight or tomorrow,
I am late for work now.

Assimp loader what is that? is that a third party tool or your own tool.
somewhere it is flipping the winding of the road.
That could be a serious problem, because if it doing to the road, it may also be doing it to other faces. You need to make sure the winding is correct, by identifying the source of that.

Anyway, I saw some of you videos, you have done lot of work on vehicle stuff.
Are you planning to use the Newton Vehicle Joint.

an finally no, you can no pass face normal to the collision, the normal are generated form the geometry. Basically the collision algorithm determine the Normal of the collision procedurally.

collision tree use the normal for trivial test only and for raycastin, but they are not significant part of collision calculation
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Fri Feb 06, 2015 1:52 pm

Ok I now know why the box collides in some places and in other pass though.
Like I said before Newton collision system is a generic closet distance calculator.
The inputs to the calculator are indeed convex shapes.

The code calculates the translation distance that resolves the interpenetration along a normal.

That code is robust and general and can result collision as along a she shape are convex, even when a shape is not convex the code resolves collision along the envelope of the convex shape. These make the algorithm robust.

However the algorithm has relatively high cost that is function of the shape complexity.
Because of that fact, it makes sense that for some shape that have special properties, sphere, capsules, polygons, and some other, that the code take advantage of those properties.

In the case of a polygon for example, If the AABB of a convex shape does no touch the perimeter of the polygon, the you know that the contact points is going to be on the polygon surfaces, no need to call the more expensive generic code that will get the same result.

It is in this citation that the code rejects the collision of the shape is on the negative side of the face, it is using the normal to decide the direction of eth transition distance.

However when the AABB touches the perimeter, the code call the generic function which report the minimum translation distance, making it looks as if there is a bug, but in reality it is the generic contact solver calculation a translation distance when the shape is close to an edge of the polygon.

Make sure that the winding is correct should resolve eh problem.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Fri Feb 06, 2015 3:41 pm

In this video are all those car your own implementation of some engine implementations


for what I can see you have some cool thing going on.
you say you want to try the Newton Vehicle, has you have anything yet?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Fri Feb 06, 2015 4:44 pm

i develop software to teach people drive on cars, buses and trucks for NPP-TRENER company in Russia, here our promotional video: http://www.youtube.com/watch?v=sbh1xnVueK4 (the video is in Russian, but you get the general idea)
here is our hardware http://auto-trener.ru/imeg/7cb6db467ecc ... 1c4437.png and these http://auto-trener.ru/imeg/.thumbs/aef7 ... 00_0_0.jpg
here is mesh loader assimp http://assimp.sourceforge.net/
I've developed my own little engine on dx11, all my demos are using it, except the old ones.
at present the vehicle physics are raycast/linearcast based, written in bullet and some parts in havok.
the car engine(clutch, drive and other things) itself is proprietary implementation, which was done before me, i mostly setup cars and develop 3d graphics.
why i wanted to try newton => because you have actual wheels, not just casts, so you have better drift, better handling and maybe it's possible to do a police turn using your physics, you've done a really great job from what i can see from demo sandbox.
currently I'm in process of integrating newton in my engine(basic things such as triangular meshes and boxes/sphere) once i finish this i will start to try integrating cars and tanks(we are planning to do bulldozer and maybe later a tank implementation)
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Fri Feb 06, 2015 6:47 pm

Ha very cool, when you get to the integration of the vehicle, let me know.

since you have code that simulate engine, transmission, and the drive train, it Is possible to extend the vehicle model to supports end use functionality.

Basically you can sub class an engine component and overload the default, then in the update function the engine will calculate the gear, engine torque, and all the thong needed to input to the tire for the sim step.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Sat Feb 07, 2015 4:35 am

engine components needs omega from each wheel, and when computations is done, it sets torque per each wheel, i remember seeing something similar in demos-sandbox. Does newton provide some form of differential axis-lock mechanism for trucks, or i have to implement it myself?
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Sat Feb 07, 2015 1:18 pm

All of that is supported yes. It may need to custom classes,
The drive train that I implemented is just a Heuristic one.
and yes is has the notion of differential lock.

But when you get there, let me know on a another thread, we can discuses some pointers.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Sun Feb 08, 2015 5:04 am

i'v sent you a pm
finished with porting cvx generation code for newton, starting integrating you car classes
so far cvx looks good
http://postimg.org/image/vbbi2kqrz/
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby e3dalive » Sun Feb 08, 2015 6:36 am

i've tried to integrate newton car from basic demo
it created hull and car itself, but in simulation it crashes here:
body0 is NULL
Code: Select all
void dNewton::OnContactProcess (dNewtonContactMaterial* const contactMaterial, dFloat timestep, int threadIndex) const
{
   dNewtonBody* const body0 = contactMaterial->GetBody0();
   dNewtonBody* const body1 = contactMaterial->GetBody1();
   body0->OnContactProcess (contactMaterial, timestep, threadIndex);
   body1->OnContactProcess (contactMaterial, timestep, threadIndex);
}

it looks like car creates body directly and not through dNewtonBody, so it doesn't set userdata.
Do i have to switch to pure newton, or is there a workaround, maybe to create fake dNewtonBody and set pure body to it, then set userdata in body to it, and do it for chasis and wheels?
i have attached the dump for you
Attachments
car.rar
(87.95 KiB) Downloaded 239 times
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Mon Feb 09, 2015 1:37 pm

yes because the dNetwon Class impemnet a dNewtonBody.
but the low lever controller build use a NetwonBody.

It is eassy to make a dVehicle controller for the newton the dNewton.
It may by complicated for a new user, so I will make one and you can build from that.

I will create one tonight.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Wed Feb 11, 2015 4:21 am

OK, for now i will try to do it in pure newton.
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby e3dalive » Wed Feb 11, 2015 1:12 pm

i managed to integrate with pure newton
Image
i have few question about car class:
why do we set gravity 2 times?
here
Code: Select all
m_controller = manager->CreateVehicle(chassisCollision, chassisMatrix, basicCarParameters.MASS, dVector(0.0f, -9.8, 0.0f, 0.0f));

and here
Code: Select all
NewtonBodySetForceAndTorqueCallback(body, ApplyGravity);

is it similar to havok external gravity that makes car better stick to the ground, or is it needed for some car calculations?
is there a way to serialise decomposed dnewtonmesh/newtoncollision/convex shape for quick loading?

test video with default car http://www.youtube.com/watch?v=H6Pp2kmneDA

i was also wondering since newton have soft bodies, is it possible to implement something like that http://www.youtube.com/watch?v=pB87M_OQJNM with only soft wheels and convex body with reasonable friction?
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Wed Feb 11, 2015 3:23 pm

-On the vehicle controller I have not because did no realize it was comment out, it should be ready I a day or two maybe by the weekend, I am glad you manage to get the low lever implementauon going
awesome.

-NewtonBodySetForceAndTorqueCallback is the generic function that apply the external force acting a body.
In the demos it only apply the gravity, but say for example you put a rocket to your car or you add wing forces, etc. that force only apply to the car chassis, and the vehicle control would no know what party of that force was due to gravity.
to solve that, the vehicle requires the user to pass the value of the gravity vector so that is knows what forces to apply to the vehicle parts like tires which are also local bodies.
and No the gravity does no act like havoc of any other engine.
There are no cheats in the vehicle controller gravity is just gravity, gravity is used for tire simulation which are also bodies in newton vehicles.

-No I have no added serialization to dClass yet.

-The video looks cool, can you drive in third person so that I can see how it works?
I like to see how it behaves with an analog controllers :mrgreen:

-There has being talk of soft body for that kind of thing but soft bodies is still a work in progress.
the one thing I would say is that the physics of soft bodies is not based on any realistic formulation.
It is one thing to put few objects connected by joint and pretend is a vehicle. and a very different one to make a production implementation of a working model that is expect to be some what realistic. There is a lot of misinformation in the work of third party technology for video games.
especially in Physics engines.
If I ever complete the soft body, I will never promote it as a component of the vehicle. unless I am sure has is a solid foundation.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Thu Feb 12, 2015 4:43 am

i found theese:
NewtonMeshSaveOFF
NewtonMeshLoadOFF
i think it's possible to serialise Newtonmesh with them
another video for you from third person http://www.youtube.com/watch?v=ajitXaoH ... e=youtu.be

for engine, as i understand i need to inherit CustomVehicleControllerComponentEngine and overload function there

you car physics is really awesome
is it possible to modify wheels in runtime => wheel_pos, spring_len, spring_str for visual car calibration?
Last edited by e3dalive on Thu Feb 12, 2015 12:08 pm, edited 1 time in total.
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests