Arska134 Posted June 10, 2013 Share Posted June 10, 2013 Hello everyone! I have to ask if someone knows solution to my problems with vehicle wheels. First of all picture: First problem is that why my vehicles wheels are going through terrain? And how it can be fixed? Second one is, while vehicle is moving wheels are not keeping their location. I am not meaning springs, but wheels are also moving in x and z axis when vehicle is moving. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
AggrorJorn Posted June 10, 2013 Share Posted June 10, 2013 Is the greenbox representing physics boundries? If so, Set a cylinder body to all wheels. How are you creating your car? Can you show some of your code? It is pretty hard to determine what is wrong without seeing how you created it. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted June 11, 2013 Author Share Posted June 11, 2013 Here is some vehicle code: Global Car:TEntity=LoadModel("abstract::"+carname$+".gmf") Local CarBody:TBody=CreateBodyBox(2,0.5,4) moveentity carBody, vec3(0,-0.2,0) SetBodyMass CarBody, CarMass EntityParent Car,CarBody entitytype carbody, 3 Global vehicle:TVehicle=CreateVehicle(CarBody) SetBodyFriction(carBody, 0.5, 0.5) AddVehicleTire(vehicle, Vec3(FRightTirePosX, FRightTirePosY, FRightTirePosZ),tireradius,suspensionlength,springconstant,springdamper) AddVehicleTire(vehicle, Vec3(BRightirePosX, BRightirePosY, BRightirePosZ),tireradius,suspensionlength,springconstant,springdamper) AddVehicleTire(vehicle, Vec3(FLeftTirePosX, FLeftTirePosY, FLeftTirePosZ),tireradius,suspensionlength,springconstant,springdamper) AddVehicleTire(vehicle, Vec3(BLeftTirePosX, BLeftTirePosY, BLeftTirePosZ),tireradius,suspensionlength,springconstant,springdamper) SetBodyMass CarBody, CarMass EntityType CarBody,2 Local tiremesh:TMesh[4] For Local i:Int=0 To 3 tiremesh[i]=CreateCylinder() Next Later in main loop: AddTireTorque(vehicle,torque,2) SetSteerAngle(vehicle,steerangle,2) AddTireTorque(vehicle,torque,0) SetSteerAngle(vehicle,steerangle,0) AddTireTorque(vehicle,torque,3) SetSteerAngle(vehicle,0,3) AddTireTorque(vehicle,torque,1) SetSteerAngle(vehicle,0,1) For Local ii:Int=0 To 3 tiremesh[ii].SetMatrix(GetTireMatrix(vehicle,ii)) Turnentity tiremesh[ii],vec3(0,0,90) scaleentity tiremesh[ii], vec3(TireRadius,TireWidth,TireRadius) Next Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted June 11, 2013 Author Share Posted June 11, 2013 Added cylinder bodies to wheels, but this happens. :/ Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
AggrorJorn Posted June 11, 2013 Share Posted June 11, 2013 Your body is created inside the ground. moveentity carBody, vec3(0,-0.2,0) Try moving it up a little. That might also be the reason your tires are stuck in the ground. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted June 11, 2013 Author Share Posted June 11, 2013 I think it's not problem because vehicle makes jump and when it's landed wheels are stuck in ground again. Here is some new code: Global Car:TEntity=LoadModel("abstract::"+carname$+".gmf") 'ScaleEntity Car,Vec3(2,0.5,4) Local CarBody:TBody=CreateBodyBox(2,0.5,4) moveentity carBody, vec3(0,-0.2,0) SetBodyMass CarBody, CarMass EntityParent Car,CarBody entitytype carbody, 3 Global vehicle:TVehicle=CreateVehicle(CarBody) SetBodyFriction(carBody, 0.5, 0.5) ' Asetellaan renkaat AddVehicleTire(vehicle, Vec3(FRightTirePosX, FRightTirePosY, FRightTirePosZ),tireradius,suspensionlength,springconstant,springdamper) 'oikea etu AddVehicleTire(vehicle, Vec3(BRightirePosX, BRightirePosY, BRightirePosZ),tireradius,suspensionlength,springconstant,springdamper) ' oikea taka AddVehicleTire(vehicle, Vec3(FLeftTirePosX, FLeftTirePosY, FLeftTirePosZ),tireradius,suspensionlength,springconstant,springdamper) ' vasen etu AddVehicleTire(vehicle, Vec3(BLeftTirePosX, BLeftTirePosY, BLeftTirePosZ),tireradius,suspensionlength,springconstant,springdamper) ' vasen taka SetBodyMass CarBody, CarMass EntityType CarBody,2 ' Create visible tires on tire places Local tiremesh:TMesh[4] Local tirebody:TBody[4] For Local i:Int=0 To 3 tiremesh[i]=CreateCylinder() tirebody[i]=CreateBodyCylinder( TireRadius, TireWidth ) entitytype tirebody[i], 2 Next And later in loop: For Local ii:Int=0 To 3 tiremesh[ii].SetMatrix(GetTireMatrix(vehicle,ii)) tirebody[ii].SetMatrix(GetTireMatrix(vehicle,ii)) Turnentity tiremesh[ii],vec3(0,0,90) Turnentity tirebody[ii],vec3(0,0,90) scaleentity tiremesh[ii], vec3(TireRadius,TireWidth,TireRadius) scaleentity tirebody[ii], vec3(TireRadius,TireWidth,TireRadius) Next Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.