OP
User
Joined: Mar 2005
Posts: 514
Brazil
|
well, I think its the NewtonJointLibrary.c file : // genetic joint functions API (CustomDestroyJoint, jointlibrary) API (CustomGetJointID, jointlibrary) API (CustomSetJointID, jointlibrary) API (CustomGetBody0, jointlibrary) API (CustomGetBody1, jointlibrary) API (CustomGetBodiesCollisionState, jointlibrary) API (CustomSetBodiesCollisionState, jointlibrary) API (CustomGetUserData, jointlibrary) API (CustomSetUserData, jointlibrary) API (CustomSetDestructorCallback, jointlibrary) API (CustomSetSubmitContraintCallback, jointlibrary)
API(CustomCreateBlankJoint, jointlibrary)
// Kinematic control joint API (CreateCustomKinematicController, jointlibrary) API (CustomKinematicControllerSetPickMode, jointlibrary) API (CustomKinematicControllerSetMaxLinearFriction, jointlibrary) API (CustomKinematicControllerSetMaxAngularFriction, jointlibrary) API (CustomKinematicControllerSetTargetPosit, jointlibrary) API (CustomKinematicControllerSetTargetRotation, jointlibrary) API (CustomKinematicControllerSetTargetMatrix, jointlibrary) API (CustomKinematicControllerGetTargetMatrix, jointlibrary)
// Generic 6 degree of Freedom Joint API (CreateCustomJoint6DOF, jointlibrary) API (CustomJoint6DOF_SetLinearLimits, jointlibrary) API (CustomJoint6DOF_SetAngularLimits, jointlibrary) API (CustomJoint6DOF_GetLinearLimits, jointlibrary) API (CustomJoint6DOF_GetAngularLimits, jointlibrary) API (CustomJoint6DOF_SetReverseUniversal, jointlibrary)
// Interface for a custom BallAndSocket joint with Limits API (CreateCustomBallAndSocket, jointlibrary) API (BallAndSocketSetConeAngle, jointlibrary) API (BallAndSocketSetTwistAngle, jointlibrary)
// Interface for a custom Hinge joint with Limits API (CreateCustomHinge, jointlibrary) API (HingeEnableLimits, jointlibrary) API (HingeSetLimis, jointlibrary)
// Interface for a custom Slider joint with Limits API (CreateCustomSlider, jointlibrary) API (SliderEnableLimits, jointlibrary) API (SliderSetLimis, jointlibrary)
// player controller functions API (CreateCustomPlayerController, jointlibrary) API (CustomPlayerControllerSetVelocity, jointlibrary) API (CustomPlayerControllerGetVisualMaTrix, jointlibrary) API (CustomPlayerControllerGetMaxSlope, jointlibrary) API (CustomPlayerControllerSetMaxSlope, jointlibrary) API (CustomPlayerControllerGetSensorShape, jointlibrary)
//// Multi rigid BodyCar controller functions //API (CreateCustomMultiBodyVehicle, jointlibrary) //API (CustomMultiBodyVehicleAddTire, jointlibrary) //API (CustomMultiBodyVehicleAddSlipDifferencial, jointlibrary) //API (CustomMultiBodyVehicleGetTiresCount, jointlibrary) //API (CustomMultiBodyVehicleGetTireBody, jointlibrary) //API (CustomMultiBodyVehicleGetSpeed, jointlibrary) //API (CustomMultiBodyVehicleGetTireSteerAngle, jointlibrary) //API (CustomMultiBodyVehicleApplyTorque, jointlibrary) //API (CustomMultiBodyVehicleApplySteering, jointlibrary) //API (CustomMultiBodyVehicleApplyBrake, jointlibrary) //API (CustomMultiBodyVehicleApplyTireRollingDrag, jointlibrary)
//// BEGIN k00m (Dave Gravel simple raycast world vehicle)API API (DGRaycastVehicleCreate, jointlibrary) API (DGRaycastVehicleAddTire, jointlibrary) API (DGRaycastVehicleSetTireTransformCallback, jointlibrary) API (DGRaycastVehicleGetTiresCount, jointlibrary) API (DGRaycastVehicleGetTiresUserData, jointlibrary) API (DGRaycastVehicleGetTireMatrix, jointlibrary) //API (DGRaycastVehicleGetSpeed, jointlibrary) //API (DGRaycastVehicleGetTirePosit, jointlibrary) //API (DGRaycastVehicleSetCustomTireBrake, jointlibrary) //API (DGRaycastVehicleSetCustomTireTorque, jointlibrary) //API (DGRaycastVehicleSetCustomTireSteerAngleForce, jointlibrary) //API (DGRaycastVehicleGenerateTiresBrake, jointlibrary) //API (DGRaycastVehicleGenerateTiresTorque, jointlibrary) //API (DGRaycastVehicleGenerateTiresSteerForce, jointlibrary) //API (DGRaycastVehicleGenerateTiresSteerAngle, jointlibrary) //API (DGRaycastVehicleSetVarTireMovePointForceFront, jointlibrary) //API (DGRaycastVehicleSetVarTireMovePointForceRight, jointlibrary) //API (DGRaycastVehicleSetVarTireMovePointForceUp, jointlibrary) //API (DGRaycastVehicleSetVarFixDeceleration, jointlibrary) //API (DGRaycastVehicleSetVarChassisRotationLimit, jointlibrary) //API (DGRaycastVehicleSetVarMaxSteerAngle, jointlibrary) //API (DGRaycastVehicleSetVarMaxSteerRate, jointlibrary) //API (DGRaycastVehicleSetVarMaxSteerForceRate, jointlibrary) //API (DGRaycastVehicleSetVarMaxSteerForce, jointlibrary) //API (DGRaycastVehicleSetVarMaxSteerSpeedRestriction, jointlibrary) //API (DGRaycastVehicleSetVarMaxBrakeForce, jointlibrary) //API (DGRaycastVehicleSetVarMaxTorque, jointlibrary) //API (DGRaycastVehicleSetVarMaxTorqueRate, jointlibrary) //API (DGRaycastVehicleSetVarEngineSteerDiv, jointlibrary) //API (DGRaycastVehicleSetVarTireSuspenssionHardLimit, jointlibrary) //API (DGRaycastVehicleSetVarTireFriction, jointlibrary) //API (DGRaycastVehicleGetTiresCount, jointlibrary) //API (DGRaycastVehicleGetVehicleOnAir, jointlibrary) //API (DGRaycastVehicleGetTireOnAir, jointlibrary) //API (DGRaycastVehicleDestroy, jointlibrary) // END
//// Pick Body joint //API (CreateCustomPickBody, jointlibrary) //API (CustomPickBodySetPickMode, jointlibrary) //API (CustomPickBodySetMaxLinearFriction, jointlibrary) //API (CustomPickBodySetMaxAngularFriction, jointlibrary) //API (CustomPickBodySetTargetRotation, jointlibrary) //API (CustomPickBodySetTargetPosit, jointlibrary) //API (CustomPickBodySetTargetMatrix, jointlibrary) //API (CustomPickBodyGetTargetMatrix, jointlibrary)
/* */
Sorry if I dont know what i´m talking about. And this is the complete code of map101.c : float temp_float;
ENTITY* FLwheelPtr; ENTITY* FRwheelPtr; ENTITY* BLwheelPtr; ENTITY* BRwheelPtr; ENTITY* tireId; ENTITY* tireModel; ENTITY* car;
D3DXMATRIX m;
action solid() { c_setminmax(me); set(my,POLYGON); vec_set(my.scale_x,vector(2,2,2)); my.flags |= FLAG8; }
action Newton_Car() { int tireMass = 30; float suspensionLength = 0.25; float suspensionSpring =700.0; float suspensionShock = 60.0; float wheelradius = 0.4; float tirePin[3] = {0.0, 1.0, 0.0}; D3DXMATRIX tire_offset; D3DXMATRIX tire_offset1; D3DXMATRIX tire_offset2; D3DXMATRIX tire_offset3; D3DXMATRIX tire_offset4; VECTOR tirepos; car = me; vec_set(my.pan,vector(180,0,0)); wait(3); NewtonBody* car_body = newton_addentity(me, 130, NEWTON_CONVEXHULL, onforceandtorque); NewtonBodySetAutoSleep( car_body, 0); NewtonBodySetLinearDamping(car_body,0.005);
D3DXMATRIX tire_offset; NewtonBodyGetMatrix(car_body,&tire_offset);
float tire_offset[16] = {0,0,1,0, 0,1,0,0, -1,0,0,0, 0,0,0,1}; float tire_offset[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; float 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, 1, 1, 0.1, 2, 70, 5, 1); DGRaycastVehicleAddTire(car_joint,NULL,vector(5,5,-1), 0.5, 1, 1, 0.1, 2, 70, 5, 1); DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,5,-1), 0.5, 1, 1, 0.1, 2, 70, 5, 1); DGRaycastVehicleAddTire(car_joint,NULL,vector(-5,-5,-1), 0.5, 1, 1, 0.1, 2, 70, 5, 1);
FLwheelPtr = ent_create("WheelL.mdl",nullvector,NULL); FRwheelPtr = ent_create("WheelR.mdl",nullvector,NULL); BLwheelPtr = ent_create("WheelL.mdl",nullvector,NULL); BRwheelPtr = ent_create("WheelR.mdl",nullvector,NULL); vec_set(tirepos,vector(20,-20,-20)); D3DXMatrixTranslation(&tire_offset1, tirepos.x ,tirepos.y ,tirepos.z ); DGRaycastVehicleAddTire(car_joint,FLwheelPtr,&tire_offset, 0.5, 0.1, 1, 0.1, 0.25, 70, 5, 1); JOINTLIBRARY_API void DGRaycastVehicleAddTire(NewtonCustomJoint *car, void *userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat friction, dFloat suspensionLength, dFloat springConst, dFloat springDamper, int castMode); vec_set(tirepos,vector(20,20,-20)); D3DXMatrixTranslation(&tire_offset1, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); D3DXMatrixTranslation(&tire_offset1, tirepos.x ,tirepos.y,tirepos.z ); DGRaycastVehicleAddTire(car_joint,FRwheelPtr,&tire_offset,20,55,0.3,1.1,0.25,60,5,1); vec_set(tirepos,vector(-20,-20,-20)); D3DXMatrixTranslation(&tire_offset1, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); D3DXMatrixTranslation(&tire_offset1, tirepos.x ,tirepos.y ,tirepos.z ); DGRaycastVehicleAddTire(car_joint,BLwheelPtr,&tire_offset,20,55,0.3,1.1,0.25,60,5,1); vec_set(tirepos,vector(-20,-20,-20)); D3DXMatrixTranslation(&tire_offset1, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); D3DXMatrixTranslation(&tire_offset1, tirepos.x ,tirepos.y ,tirepos.z); DGRaycastVehicleAddTire(car_joint,BRwheelPtr,&tire_offset,20,55,0.3,1.1,0.25,60,5,1);
FLwheelPtr = ent_create("WheelR.mdl",vector(0,0,-500),NULL); vec_for_bone(tirepos,me,"FRBone"); vec_sub(tirepos,my.x); D3DXMatrixTranslation(&tire_offset2, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); DGRaycastVehicleAddTire(car_joint,FRwheelPtr,&tire_offset2,20,0.35,0.3,1.1,0.25,60,5,1); FLwheelPtr = ent_create("WheelL.mdl",vector(0,0,-500),NULL); vec_for_bone(tirepos,me,"BLBone"); vec_sub(tirepos,my.x); D3DXMatrixTranslation(&tire_offset3, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); DGRaycastVehicleAddTire(car_joint,BLwheelPtr,&tire_offset3,20,0.35,0.3,1.1,0.25,60,5,1); FLwheelPtr = ent_create("WheelR.mdl",vector(0,0,-500),NULL); vec_for_bone(tirepos,me,"BRBone"); vec_sub(tirepos,my.x); D3DXMatrixTranslation(&tire_offset4, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); DGRaycastVehicleAddTire(car_joint,BRwheelPtr,&tire_offset4,20,0.35,0.3,1.1,0.25,60,5,1); FLwheelPtr = ent_create("tekerlekL.mdl",nullvector,NULL); vec_for_bone(tirepos,me,"FLBone"); vec_sub(tirepos,my.x); D3DXMatrixTranslation(&tire_offset, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER); NewtonVehicleAddTire(car_joint, &tire_offset, tirePin[0], tireMass, wheelradius, wheelradius, suspensionShock,suspensionSpring,suspensionLength, FLwheelPtr, 5); tPos = rv_Tires[i].rt_Mesh->ob_Matrix.m_posit; DGRaycastVehicleAddTire(car_joint,FLwheelPtr, &tire_offset, 20, //rv_Tires[i].rt_Mass, 0.35, //rv_Tires[i].rt_Radius, 0.3, //rv_Tires[i].rt_Width, 1.1, //rv_Tires[i].rt_Friction, 0.25, //rv_Tires[i].rt_SuspensionLenght, 60, //rv_Tires[i].rt_SuspensionConst, 5, //rv_Tires[i].rt_SuspensionDamping, 1 //rv_CastMode ); FRwheelPtr = ent_create("tekerlekR.mdl",nullvector,NULL); BLwheelPtr = ent_create("tekerlekL.mdl",nullvector,NULL); BRwheelPtr = ent_create("tekerlekR.mdl",nullvector,NULL); while(car != NULL) { // /* // // SET ALL TIRES POSITION AND ANGLE [ THESE LINES ARE NOT AT TIRE CALLBACK FUNC. BECAUSE MAKING THAT CAUSES VISUAL TIRES TO UPDATE 1 FRAME LATER THAN NEWTON TIRES ] for (tireId = NewtonVehicleGetFirstTireID (car_joint); tireId!=NULL; tireId = NewtonVehicleGetNextTireID (car_joint, tireId)) { tireModel = NewtonVehicleGetTireUserData (car_joint, tireId); NewtonVehicleGetTireMatrix(car_joint,tireId, m); ent_setmatrix_rb(tireModel,m); } // DGRaycastVehicleSetCustomTireTorque(car_joint,1,1500); DGRaycastVehicleSetCustomTireTorque(car_joint,0,1500); car_camera_move(); wait(1); } }
Last edited by Carloos; 08/15/13 16:37.
|