Implementation of Dave Gravel's raycast car

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

Moderator: Alain

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Mon Jun 29, 2009 10:03 am

That sopdul no be so hard to get,
Like I say I am making a tutorial using the C SDK and not using any file format, the geometry will be a series on point in the same file.
The David will put iut in the Wiki.

I am late but I will try to get it going this week.

I hope that help.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Mon Jun 29, 2009 11:10 am

i understood that, but i cant understand, why almost the same code doesn't work :(
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Mon Jun 29, 2009 1:18 pm

I know.
One of the reasons I am making he tutorial is precisely that demo, your inability to get the joint going, and the inability of so many other people to get thong going.
Leadwerk car demo is cool and can drive, but it is not what I am ambitioned for user of the engine.
The way I see it if you are going to use a physics engine, then the result should be worthwhile.
A car made with a physics engine must match the quality, and performance of the best car simulation on the best video game other, anything less than that is unacceptable to me.
This is why I am revisiting David’s the car joint and finishing all of the loose ends.

I realize this is my fault because I have not put any time in documentation the engine feature. Instead I wrote demos that maybe easy for me, David, Walaber seems simple, but for the large majority of people they are still too complex.
So I am making these tutorials that are simple project, with no fancy graphics, they will be lesson that will explain to people in Plain English what is going on.
Do not worry about the broken English; I will have Delfi as editor.
I already have the first tutorial, and I am writing the Text file to send to David.
After this Framework I will jump to make the car, since there are few people stocked on it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Mon Jun 29, 2009 1:26 pm

Having said that I am Looking at you code, and I believe yor tires are in teh wrong place.

Code: Select all
loat tire_offset[16] = {1,0,0,0,   0,1,0,0,   0,0,1,0,    0,0,0,1};
NewtonJoint* car_joint = DGRaycastVehicleCreate(4, tire_offset, car_body);

DGRaycastVehicleAddTire(car_joint,NULL,vector(5,-5,-1),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(5,5,-1) ,   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,5,-1),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,-5,-1),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);

you are setting car whet eh fornt direction is teh vetors (1, 0, 0)
the up vector (gravity vector is) (0, 1, )

that means that the tire must be on the xz, plane but you are placing then on the xy plane.

If you up vector is 0, 1, 0) Then your tire must be something like:

Code: Select all
DGRaycastVehicleAddTire(car_joint,NULL,vector(5,-1,-5),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(5,-1, 5) ,   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,-1,-5),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,-1, 5),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);


the traction are eithr tires 0, and 1,
or 2, and 3

could you try that and see what you get?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby JernejL » Mon Jun 29, 2009 1:50 pm

Julio: This is good, any tutorials and descriptions for new functions will help the documentation greatly, there's already a good tutorials page here: http://newtondynamics.com/wiki/index.ph ... =Tutorials but some are outdated and will need to be reformatted a bit, i can easily do this once you have the new tutorials ready, just send them to me in a PM.

There's also a list of functions that so far lack documentation on wiki, some functions like those dealing with contact joints in contact should deserve some more attention as the contact callback is the biggest change in newton 2 since newton 1.53 and may confuse some people who will port apps over. I will try to add some description in upcoming time but it would be great if you write some description and notes / remarks for these as you know the new functions the most:
http://newtondynamics.com/wiki/index.ph ... escription
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Mon Jun 29, 2009 5:56 pm

and performance of the best car simulation on the best video game other, anything less than that is unacceptable to me.

respect for you, Julio :)

about car: it doesn't work again :(
i missed that Y and Z axes are changed, but even after changing, car mesh just drops down and thats all :cry:
it ignores wheels... what else it could be caused?

the traction are eithr tires 0, and 1,
or 2, and 3

i set
DGRaycastVehicleSetCustomTireTorque(car_joint,1,1500);
DGRaycastVehicleSetCustomTireTorque(car_joint,2,1500);
to see at least a simple movement, i also tried with 0 and 1, but....

btw, i can also help with basic tutorials, i already wrote first one for GS users
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Mon Jun 29, 2009 6:01 pm

i noticed that width and radius was too small and i got a little hope... but still wheels are ignored
Code: Select all
   NewtonBody* car_body = newton_addentity(me, 130, NEWTON_CONVEXHULL, onforceandtorque);

   float tire_offset[16] = {1,0,0,0,   0,1,0,0,   0,0,1,0,    0,0,0,1};
   NewtonJoint* car_joint = DGRaycastVehicleCreate(4, tire_offset, car_body);

   DGRaycastVehicleAddTire(car_joint,NULL,vector(15,-1,-15),   0.5, 14, 5, 0.1, 0.25, 70, 5, 1);
   DGRaycastVehicleAddTire(car_joint,NULL,vector(15,-1,15) ,   0.5, 14, 5, 0.1, 0.25, 70, 5, 1);
   DGRaycastVehicleAddTire(car_joint,NULL,vector(-15,-1,-15),  0.5, 14, 5, 0.1, 0.25, 70, 5, 1);
   DGRaycastVehicleAddTire(car_joint,NULL,vector(-15,-1,15),   0.5, 14, 5, 0.1, 0.25, 70, 5, 1);
   
   while(me!=NULL)
   {   
      DGRaycastVehicleSetCustomTireTorque(car_joint,1,1500);
      DGRaycastVehicleSetCustomTireTorque(car_joint,0,1500);
      
      camera_func();
      
      wait(1);
   }
}
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Mon Jun 29, 2009 6:10 pm

hm.. that little hope dont want to die :)))
i'd try to add walls from different sides, maybe its something else with coordinate system....

no (
car doesn't react at walls and roof, in case if rays looked there
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Mon Jun 29, 2009 6:36 pm

Somethong must be funsamnetally wrong, tell me something what is the coodenate system in your enfine?
is the gravity vector along (0, -1, 0) OR (0, 0, -1)
who do you set the gravity in the call back?

VeT wrote:btw, i can also help with basic tutorials, i already wrote first one for GS users

This is very nice of you, and after I get the basic tutorial out maybe you can use them open to check taht your toturial follow a recomend method.
The reason I want to post these in because I have negleted the task for a long time. The engine allows for so many different way to do things,
sometime it happens that after some trial and error people get something goint and they think that is the most efficient or the only way to do thing.
These tutorial are meant to hint users how to use the engine features at the very fundamemental level, and for there they can experiment on thier own.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Mon Jun 29, 2009 6:54 pm

as you can see (well, now filefront is making something strange and all links are broken, so here is direct link: http://wwwnew.filefront.com/13916733/Li ... 02.v20.rar ), i wrap some basic features, as
List of demos:
map10: Simple bodies
map11: Restitution demo
map12: Friction demo
map13: Cone demo
map14: Scale demo
map15: Grabbing demo
map16: Step-by-step creating
map17: Explosions
map18: Static bodies
map19: Power mouse
map20: Crash test
map21: Impulse weapon demo
map22: Collisions and sound
map23: Byouancy (finished in v 21, but still not published)
map50: Compound collision demo
map100: Simple joints
map101: Car physics(in process)

so i can write tutorial about any level, if you would give me example, as you wrote before :)

Okay, lets back to cars: engine uses (X,Y,Z) coordinate system:
Code: Select all
//--------------------------------------------------------------------------------------- onforceandtorque()
// callback which applies gravity to active physics entities
//---------------------------------------------------------------------------------------
void onforceandtorque(NewtonBody* body)
{
   float mass, ixx, iyy, izz;
   NewtonBodyGetMassMatrix(body, &mass, &ixx, &iyy, &izz);
   NewtonBodySetForce(body, vectorf(0, 0, -9.8 * mass));
}
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Mon Jun 29, 2009 7:44 pm

Is see your gravity is along the z axis, you problem is the car coordinate system is wrong,
I am going to assume the car front direction is the y axis (0, 1, 0)
You creation parameter should be

Code: Select all
 loat tire_offset[16] = {0,1,0,0,   0,0,1,0,   1,0,0,0,    0,0,0,1};
NewtonJoint* car_joint = DGRaycastVehicleCreate(4, tire_offset, car_body);

DGRaycastVehicleAddTire(car_joint,NULL,vector(5,-5,-1),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(5,5,-1) ,   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,5,-1),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);
DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,-5,-1),   0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1);

try before if run yor demos and tell me if the car rest of the floor on the tires.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Tue Jun 30, 2009 3:40 pm

nothing again... unbelievable... i'll try to combine all your advices, but.. heh, i also checked, if library is loaded.. yes, it is... damned, it ignores wheels and thats all :(
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Tue Jun 30, 2009 4:18 pm

with this initalization the car must be on the wheels
loat tire_offset[16] = {0,1,0,0, 0,0,1,0, 1,0,0,0, 0,0,0,1};
NewtonJoint* car_joint = DGRaycastVehicleCreate(4, tire_offset, car_body);

make a video.
I cannot run your demos, the crash on launch
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby Julio Jerez » Tue Jun 30, 2009 4:28 pm

do you have any idea why your demos crash in my machine.

If I can run the car test I may be able to see what is wrong.
I have me intrigued already.
Yo cordenated system uses z up, so maybe there is something wrong in the joint.

when I run your demo I see a massage tha say

Conitec, Sandiego .....

c\tmp\LiteCNewton2.02\main.exe damaged
Startup failure - any key to abort
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Implementation of Dave Gravel's raycast car

Postby VeT » Tue Jun 30, 2009 5:55 pm

exe-file is from old build, i don't update it.
For launching, you need 3D GameStudio ( http://server.conitec.net/down/gstudio_setup.exe )
As you would install it, just open main.c with the help of SED (Script EDitor) and run it
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

PreviousNext

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 8 guests