Issue with x axis flipped on vehicle #371
-
In the jolt vehicle constraint test, I have modified the code for generating the wheel settings to easily identify which wheels were which. I just changed the position to be offset differently for the X for one side on the front & back. // Wheels WheelSettingsWV *w1 = new WheelSettingsWV; w1->mPosition = Vec3(half_vehicle_width * 2, -0.9f * half_vehicle_height, half_vehicle_length - 2.0f * wheel_radius); w1->mMaxSteerAngle = max_steering_angle; w1->mMaxHandBrakeTorque = 0.0f; // Front wheel doesn't have hand brake WheelSettingsWV *w2 = new WheelSettingsWV; w2->mPosition = Vec3(-half_vehicle_width, -0.9f * half_vehicle_height, half_vehicle_length - 2.0f * wheel_radius); w2->mMaxSteerAngle = max_steering_angle; w2->mMaxHandBrakeTorque = 0.0f; // Front wheel doesn't have hand brake WheelSettingsWV *w3 = new WheelSettingsWV; w3->mPosition = Vec3(half_vehicle_width * 2, -0.9f * half_vehicle_height, -half_vehicle_length + 2.0f * wheel_radius); w3->mMaxSteerAngle = 0.0f; WheelSettingsWV *w4 = new WheelSettingsWV; w4->mPosition = Vec3(-half_vehicle_width, -0.9f * half_vehicle_height, -half_vehicle_length + 2.0f * wheel_radius); w4->mMaxSteerAngle = 0.0f; I have attached an image showing a comparison between my engine and jolt's vehicle test. The first thing i'm confused about is why is the x axis flipped (In the jolt test)? The wheels with a negative x are on the right and the wheels with a positive x are on the left (In the Jolt test). I am also having the issue of in my engine where since the x axis is flipped (in comparison to the jolt test), my wheels turn the wrong way. I know I can just reverse what I am passing into for the right value into controller->SetDriverInput but I wanted to see what the alternatives are and if there is some setting I should be changing. I was also concerned that if the wheels are meant to turn at different speeds based on how far they are turned that this would cause issues to just reverse the -right instead of fixing the problem at hand. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
SetDriverInput with inRight = 1 is supposed to steer to the right, so there's definitively something wrong. How have you configured VehicleConstraintSettings::mUp and VehicleConstraintSettings::mForward? By default Z is forward and Y is up. Jolt uses a right handed coordinate system so X must be left. So that's why the left wheel has positive X and the right wheel negative X. If your X axis is flipped, you're probably using a left handed coordinate system which is also valid, but not the one Jolt is using. Can you confirm which axis points in which direction in your engine? |
Beta Was this translation helpful? Give feedback.
SetDriverInput with inRight = 1 is supposed to steer to the right, so there's definitively something wrong.
How have you configured VehicleConstraintSettings::mUp and VehicleConstraintSettings::mForward? By default Z is forward and Y is up. Jolt uses a right handed coordinate system so X must be left. So that's why the left wheel has positive X and the right wheel negative X. If your X axis is flipped, you're probably using a left handed coordinate system which is also valid, but not the one Jolt is using.
Can you confirm which axis points in which direction in your engine?