use rake angle for neck too

This commit is contained in:
Joe Ardent 2023-02-19 16:28:26 -08:00
parent b6443e8cbe
commit 80e2a79de1
1 changed files with 3 additions and 2 deletions

View File

@ -22,6 +22,7 @@ pub fn spawn_tires(
let ccd = Ccd { enabled: true }; let ccd = Ccd { enabled: true };
let limits = conf.limits; let limits = conf.limits;
let (meshes, materials) = meshterials; let (meshes, materials) = meshterials;
let rake_vec: Vec3 = Vec3::new(0.0, 1.0, 0.57).normalize(); // about 30 degrees of rake
let tire = Tire { let tire = Tire {
radius: wheel_rad, radius: wheel_rad,
@ -78,7 +79,7 @@ pub fn spawn_tires(
let damping = conf.damping; let damping = conf.damping;
let prismatic_axis = if steering.is_some() { let prismatic_axis = if steering.is_some() {
Vec3::new(0.0, 1.0, 0.57).normalize() // about 30 degrees of rake rake_vec
} else { } else {
Vec3::Y Vec3::Y
}; };
@ -96,7 +97,7 @@ pub fn spawn_tires(
let axel_parent_entity = if let Some(steering) = steering { let axel_parent_entity = if let Some(steering) = steering {
let neck_builder = let neck_builder =
RevoluteJointBuilder::new(Vec3::Y).local_anchor1(Vec3::new(0.0, 0.0, 0.1)); // this adds another 0.1m of trail RevoluteJointBuilder::new(rake_vec).local_anchor1(Vec3::new(0.0, 0.0, 0.1)); // this adds another 0.1m of trail
let neck_joint = MultibodyJoint::new(fork_rb_entity, neck_builder); let neck_joint = MultibodyJoint::new(fork_rb_entity, neck_builder);
let neck = commands let neck = commands
.spawn(RigidBody::Dynamic) .spawn(RigidBody::Dynamic)