Dave Gravel's raycast car questions

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Dave Gravel's raycast car questions

Postby Leadwerks » Fri Jan 23, 2009 11:49 am

Code: Select all
DGRaycastVehicleCreate (int maxTireCount, int chassisAxis, int tractionAxis, int steerAxis, int frictionAxis, const dFloat* cordenateSytem, NewtonBody* carBody, const dFloat* gravity);

-What are the chassis, traction, steer, and friction axes? Do they start at 0 or 1?
-What is the coordinate system parameter?

Code: Select all
DGRaycastVehicleAddTire (NewtonCustomJoint *car, void *userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat suspensionLength, dFloat springConst, dFloat springDamper, int castMode);

-What are some example values for springConst and springDamper?
-What are the possible values for castMode, and what do they do?

Code: Select all
JOINTLIBRARY_API void DGRaycastVehicleSetVar(NewtonCustomJoint *car, dFloat chassisOmegaCorrection, dFloat engineForce, dFloat steerForce);

-What should chassisOmegaCorrection be?
-What is engineForce? Will it work right if I just increment a value when a key is pressed, or do I have to do something more complicated? I had a lot of problems with wheels slipping in the multibody implementation.

Thank you.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Dave Gravel » Fri Jan 23, 2009 12:49 pm

Some of this variable can change on my next version because I use it only for my personal debug.

// I remove some of this variable on my next version...
// It define the matrix row to apply my value.
int chassisAxis, int tractionAxis, int steerAxis, int frictionAxis,

ChassisAxis{ caFront, caUp, caRight }; Default value 1 this is use with local matrix to define the tire working space.
TractionAxis{ taFront, taUp, taRight }; Default value 0 this is use to apply the engine force and torque at the good side.
SteerAxis{ saFront, saUp, saRight }; Default value 2 this is use to apply the steer force and torque at the good side.
FrictionAxis{ faFront, faUp, faRight }; Default value 2 but this one is removed internally now, not use anymore...

The springConst and springDamper is really personal to your vehicle.
It depending from your vehicle mass and the world gravity and more...
Generally I play with springConst value around 30 to 150, the springDamper is really personal and depending from the Const and your personal choice.
Exemple a Const set to 70 can look natural with a damp around 4 or 5, but again it depending from the vehicle type and the vehicle mass.

castMode value 0 the vehicle use the raycast world internally for generate the tire, value 1 use the convexcast internally for generate the tire.
chassisOmegaCorrection avoid rotation on the vehicle chassis.
The value play around 0.1 to 1, exemple you have a long vehicle chassis you can need to use high value like 0.995 the default is 0.98.
If you have a short vehicle chassis you need to reduce the value exemple 0.95 or lower.
This fake the slipping reaction in same time, just to make some test with this value.

The way how work the engineforce can change later, it is a static value use at the vehicle construction.
I have add it because I have rewrite this code from a personal pascal project and at the begin I have implement it same.
Now it can need a work around to make it better.
oxDGRaycastVehicleSetVar(FData,FChassisOmegaCorrection,FChassisEngineForce,FChassisSteerForce);
My current default value is 0.98,40,60 call oxDGRaycastVehicleSetVar at the begin when the vehicle and tire is already create.
This method can change later...

Will it work right if I just increment a value when a key is pressed, or do I have to do something more complicated?

It's a little bit more complicated.
Take a look on this file in coming with my demo.
oxN2VehicleWorldRaydll.pas
It is very similar to the multibodyvehicle method, I can make something a lot more simple on next version.
I working on the vehicle code today and try to update it soon with some new nice fix.
I know what you need about the way to apply steer and engine I try to make it simple today and I update the code on the night.

Sorry if it is not all clear but you need to understand it is again in construction and many thing can change in futur version.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Dave Gravel's raycast car questions

Postby Leadwerks » Fri Jan 23, 2009 4:11 pm

Does the tire index start at 0 or 1?
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Dave Gravel » Fri Jan 23, 2009 4:47 pm

with zero
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Dave Gravel's raycast car questions

Postby Leadwerks » Fri Jan 23, 2009 5:34 pm

What is the coordinate system parameter in DGRaycastVehicleCreate()?
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Dave Gravel » Fri Jan 23, 2009 5:40 pm

Currently you can't change it, I use the default coord system use with all newton demo.
It depending more from the vehicle mesh.

car chassis:
front
up = gravity
right = direction axis

The best open my vehicle 3d mesh in my demo with a modeler and base your mesh on this direction.
After at the vehicle creation you can rotate the vehicle on any direction.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Dave Gravel's raycast car questions

Postby Leadwerks » Fri Jan 23, 2009 6:10 pm

What should I use for that parameter?
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Dave Gravel » Fri Jan 23, 2009 6:16 pm

It's hard to say i don't know about what parameter you talking.
In the post before I have say all default value you just have to use this like default currently it working only with default value.
Like I have say for now it's only for me to debug some stuff, but they is surely all removed later.

If i'm not wrong you just need to use the same value that you use with multibodyvehicle for the rest...
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Dave Gravel's raycast car questions

Postby Leadwerks » Fri Jan 23, 2009 6:25 pm

I am asking about the "cordenateSytem" parameter in this function:
Code: Select all
DGRaycastVehicleCreate (int maxTireCount, int chassisAxis, int tractionAxis, int steerAxis, int frictionAxis, const dFloat* cordenateSytem, NewtonBody* carBody, const dFloat* gravity);
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Dave Gravel » Fri Jan 23, 2009 6:33 pm

Ok for this I use my default body matrix object.
Code: Select all
procedure TOXVehicleBasicRayWorld.InitNewton;
var tmp: TOXMatrix;
    i: int;
    tire: TOXRayTire;
    tPos: TOXVector4;
    gravity: TOXVector4;
begin
  inherited;
  gravity:=oxV4Make(0,-10,0);
  NewtonBodyGetMatrix(Newton.Body,@tmp[0]);
  //default value for the default vehicle code setup
  FData:=oxDGRaycastVehicleCreate(FData,4,1,0,2,2,@tmp[0],Newton.Body,@gravity[0]);
  for i:=0 to FTiresCount-1 do begin
    tire:=FTires[i];
    tPos:=tire.Position.AsVector;
    oxDGRaycastVehicleAddTire(FData,tire,@tPos[0],tire.FMass,tire.FRadius,tire.FWidth,
                              tire.FSuspensionLimit,tire.FSuspensionConst,tire.FSuspensionDamping,1); // use 1 convexcast
  end;
  oxDGRaycastVehicleSetVar(FData,FChassisOmegaCorrection,FChassisEngineForce,FChassisSteerForce);
  NewtonBodySetTransformCallback(Newton.Body,@oxDGVehicleTransform);
end;
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Dave Gravel's raycast car questions

Postby Leadwerks » Sat Jan 24, 2009 2:42 am

For anyone else reading this, the tires are oriented so they roll along the X axis.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Julio Jerez » Sat Jan 24, 2009 2:49 am

leadwerk had you gotten any result, we arte having some very go result so far.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dave Gravel's raycast car questions

Postby Leadwerks » Sat Jan 24, 2009 4:09 pm

Yes, it is working now, thanks. :D

I am updating the engine, and will send a new version to "TheoLogic" today.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Dave Gravel's raycast car questions

Postby Julio Jerez » Sat Jan 24, 2009 4:46 pm

Ha very good, it make me feel much better.
The Logic I hope this is no too late.
I am vey sorry fo rteh delay, and I apologise for it

Much of the thank goes to Dave Gravel (master K00m), hwo took ownership of the car joint.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dave Gravel's raycast car questions

Postby tylerp9p » Sat Feb 14, 2009 6:55 pm

In the present version of the Leadwerks Engine and Newton implementation, the tires are rotating around the Z Axis.

From what I hear Dave is the only one who can fix this? It is honestly ruining about 5 projects I am working on right now, 3 of which are commercial and time sensitive. :?
tylerp9p
 
Posts: 2
Joined: Wed Jul 16, 2008 11:46 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 19 guests