A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Dave Gravel » Sat Feb 14, 2009 7:12 pm
The tire depend from the chassis matrix just to rotate your chassis.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by VeT » Sat Mar 07, 2009 10:37 am
hm...
you were wrote that syntaxis is
DGRaycastVehicleCreate (int maxTireCount, int chassisAxis, int tractionAxis, int steerAxis, int frictionAxis, const dFloat* cordenateSytem, NewtonBody* carBody, const dFloat* gravity);
but in latest Newton's beta (i re-downloaded 2 minutes ago) its
JOINTLIBRARY_API NewtonCustomJoint *DGRaycastVehicleCreate (int maxTireCount, const dFloat* cordenateSytem, NewtonBody* carBody);
so, i tried
- Code: Select all
D3DXMATRIX body_matrix;
NewtonBodyGetMatrix(car_body,body_matrix);
NewtonCustomJoint * car =DGRaycastVehicleCreate(4,body_matrix,car_body);
compiler tell nothing but crashes
what is wrong?
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by Dave Gravel » Sat Mar 07, 2009 10:56 am
This is how I use it from c++,
http://evadlevarg.googlepages.com/DGVCode.zipI think your error is because your forget to pass the matrix like a pointer at the creation and maybe when you get it too.
It surely create and push a NULL matrix and generate a error.
Good luck.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by VeT » Sat Mar 07, 2009 11:07 am
no-no, lite-c works with pointers automatically
anyway, i tried with pointers... i think that trouble in function call, syntaxis of parameters(like i wrote in the begining of previous post)
i'd look through your c++ code, maybe this would help
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by Dave Gravel » Sat Mar 07, 2009 11:12 am
I'm pretty sure this function request a matrix pointer
rv_Joint = DGRaycastVehicleCreate(rv_TiresCount,&tmp[0][0],rv_Mesh->ob_Body);
Maybe it is different because it is a call direct to the dll no idea.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by VeT » Sat Mar 07, 2009 11:56 am
DGRaycastVehicleCreate(4,body_matrix,car_body);
crashes like
DGRaycastVehicleCreate(4,1,2,3,body_matrix,car_body);
so its looking like trouble with parameters
i tried another(older) version of dll, the similar crash...
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by VeT » Sun Mar 08, 2009 4:04 pm
there were one of the GameStudio's "feature"
)
Vehicle is still not works for me, but now at least i know, where to move
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by VeT » Mon Mar 09, 2009 6:53 am
//DGRaycastVehicleAddTire (NewtonCustomJoint *car, void *userData,
what userData is? pointer to graphical entity(just model) or to newton body?
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by VeT » Mon Mar 09, 2009 11:28 am
damned... looking like i'm totaly lost in your versions...
in your delphi's example there is oxDGRaycastVehicleSetVar(FData,FChassisOmegaCorrection,FChassisEngineForce,FChassisSteerForce); , do i need this ?
your c++ example is looking like that there isnt that function(i think its more modern), but my example dont work properly
- Code: Select all
action Newton_Car()
{
int rv_TiresCount = 1;
int i;
D3DXMATRIX tire_offset;
VECTOR tirepos;
// set(my,INVISIBLE);//hide the physical proxy
while(!newton_running){wait(1);}
wait(3);
NewtonBody* CarBody = newton_addentity(me, 100, NEWTON_CONVEXHULL, onforceandtorque);
NewtonBodySetAutoSleep(CarBody, 0);
// ent_create("kasa1.mdl",my.x,Visual_Car);//car model
D3DXMATRIX body_matrix;
NewtonBodyGetMatrix(CarBody, body_matrix);
NewtonCustomJoint* car_joint = DGRaycastVehicleCreate(4,body_matrix,CarBody);
// 1
vec_for_bone(tirepos,me,"osag");
D3DXMatrixTranslation(&tire_offset, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER);
you = ent_create("wheel.mdl",tirepos,NULL);
NewtonBody* WheelBody = newton_addentity(you, (float)75, NEWTON_CONVEXHULL, onforceandtorque);
DGRaycastVehicleAddTire(car_joint,
WheelBody, //&rv_Tires[i],
tire_offset, // tpos
20, // rv_Tires[i].rt_Mass,
0.035,// rv_Tires[i].rt_Radius,
0.3, // rv_Tires[i].rt_Width,
1.1, // rv_Tires[i].rt_Friction,
0.2, // rv_Tires[i].rt_SuspensionLenght,
70, // rv_Tires[i].rt_SuspensionConst,
4, // rv_Tires[i].rt_SuspensionDamping,
1); // rv_CastMode);
// and so on for every wheel
car is created; wheels are created on the position, where they are need; wheels and car fall down as expected; but there is no connection between them and car
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by Dave Gravel » Mon Mar 09, 2009 11:35 am
The delphi code is a old version, and the c++ code is the most recent version.
The tire don't need any physic body, you just push the userdata visual representation no more...
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by JernejL » Mon Mar 09, 2009 1:38 pm
tylerp9p wrote: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.
Why don't you just rotate the cars? create them on the proper Z axis and set the matrix to place them on ground properly
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by VeT » Mon Mar 09, 2009 3:14 pm
//The tire don't need any physic body, you just push the userdata visual representation no more...
hm... when i passed just the name of model, it creates the wheel, but without any physic
where i can see the latest example of your car and get dll, that would work with that example?
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by VeT » Mon Mar 09, 2009 5:57 pm
okay, thanks, i'll look this one
thats good, but what about sorces?
-
VeT
-
- Posts: 84
- Joined: Thu Jul 31, 2008 11:31 am
by Dave Gravel » Mon Mar 09, 2009 6:10 pm
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 23 guests