darrenc182 Posted July 2, 2010 Share Posted July 2, 2010 I am having trouble implementing vehicles using the raycast vehicle implementation with Leadwerks Engine 2.31. Below is how I am creating the vehicle: pos = EntityPosition(vehicle); if(!CreateEntity(vehicle)) return false; PositionEntity(vehicle, pos); SetBodyMass(vehicle, 5.0f); EntityType(m_Entity, 3); wheel[0]=LoadModel("abstract::hmmwv_tire.gmf"); wheel[1]=LoadModel("abstract::hmmwv_tire.gmf"); wheel[2]=LoadModel("abstract::hmmwv_tire.gmf"); wheel[3]=LoadModel("abstract::hmmwv_tire.gmf"); tire_pos[0] = EntityPosition(FindChild(m_Entity, "Tire01"), 0); tire_pos[1] = EntityPosition(FindChild(m_Entity, "Tire02"), 0); tire_pos[2] = EntityPosition(FindChild(m_Entity, "Tire03"), 0); tire_pos[3] = EntityPosition(FindChild(m_Entity, "Tire04"), 0); m_vVehicle=CreateVehicle(m_Entity); int tire1 = AddVehicleTire(m_vVehicle,tire_pos[0], 5.0f, 0.0f, 20.0f); int tire2 = AddVehicleTire(m_vVehicle,tire_pos[1], 5.0f, 0.0f, 20.0f); int tire3 = AddVehicleTire(m_vVehicle,tire_pos[2], 5.0f, 0.0f, 20.0f); int tire4 = AddVehicleTire(m_vVehicle,tire_pos[3], 5.0f, 0.0f, 20.0f); The variable vehicle stores the vehicles chassis mesh. When the vehicle is created it does one of two things. The vehicle's chassis either falls half way through the floor of my level or it bounces all over the place. This image illustrates what I was talking about with the vehicle falling half way through the floor. This second image shows the physics bodies for the vehicle and the vehicle's wheels. This final image shows the start position of the vehicle when it is created. This is the position that is received from the PositionEntity(vehicle, pos) function call. Here is the update code for updating the vehicle every clock cycle. TVec16 chassisMatrix; SetEntityMatrix(wheel[0],GetTireMatrix(m_vVehicle,0)); SetEntityMatrix(wheel[1],GetTireMatrix(m_vVehicle,1)); SetEntityMatrix(wheel[2],GetTireMatrix(m_vVehicle,2)); SetEntityMatrix(wheel[3],GetTireMatrix(m_vVehicle,3)); SetSteerAngle(m_vVehicle, 25.0f, 0); SetSteerAngle(m_vVehicle, 25.0f, 1); I would really appreciate any and all help with this problem because it's been kicking my butt for a long time. I don't know if it's a problem with my implementation or if it is a limitation of the vehicle implementation within the engine. Like I said any and all help to correct this problem will be greatly appreciated. Thank you in advance. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. 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.