From fd4155ceab29e56ad5b5bdb49c8b9f0401159437 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Wed, 15 Feb 2023 16:15:55 -0800 Subject: [PATCH] remove dead code --- src/bike/wheels.rs | 51 ++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/bike/wheels.rs b/src/bike/wheels.rs index ad28ea8..2f418cb 100644 --- a/src/bike/wheels.rs +++ b/src/bike/wheels.rs @@ -1,15 +1,15 @@ use bevy::prelude::{shape::UVSphere as Tire, *}; use bevy_rapier3d::prelude::{ - Ccd, Collider, ColliderMassProperties, CollisionGroups, Damping, ExternalForce, Friction, - MultibodyJoint, PrismaticJointBuilder, Restitution, RevoluteJointBuilder, RigidBody, Sleeping, - TransformInterpolation, + Ccd, CoefficientCombineRule, Collider, ColliderMassProperties, CollisionGroups, Damping, + ExternalForce, Friction, MultibodyJoint, PrismaticJointBuilder, Restitution, + RevoluteJointBuilder, RigidBody, Sleeping, TransformInterpolation, }; use super::{CyberWheel, Meshterial, WheelConfig, BIKE_WHEEL_COLLISION_GROUP}; pub fn spawn_tires( commands: &mut Commands, - xform: &Transform, + _xform: &Transform, bike: Entity, conf: &WheelConfig, meshterials: &mut Meshterial, @@ -47,8 +47,8 @@ pub fn spawn_tires( }; let friction = Friction { - coefficient: 0.0, - ..Default::default() + coefficient: 0.8, + combine_rule: CoefficientCombineRule::Min, }; let mut wheel_poses = Vec::with_capacity(2); @@ -70,22 +70,19 @@ pub fn spawn_tires( } for offset in wheel_poses { - let trans = xform.translation + offset; - let wheel_pos_in_world = Transform::from_rotation(xform.rotation).with_translation(trans); let wheel_damping = Damping { linear_damping: 0.8, ..Default::default() }; let wheel_collider = Collider::ball(wheel_rad); let mass_props = ColliderMassProperties::Density(0.1); - let damping = conf.damping; + let prismatic_builder = PrismaticJointBuilder::new(Vec3::Y) .local_anchor1(offset) .limits(limits) .motor_position(limits[0], stiffness, damping); let prismatic_joint = MultibodyJoint::new(bike, prismatic_builder); - let fork_rb_entity = commands .spawn(RigidBody::Dynamic) .insert(prismatic_joint) @@ -93,22 +90,22 @@ pub fn spawn_tires( let revolute_builder = RevoluteJointBuilder::new(Vec3::X); let axel_joint = MultibodyJoint::new(fork_rb_entity, revolute_builder); - commands - .spawn(RigidBody::Dynamic) - .insert(( - wheel_collider, - mass_props, - wheel_damping, - ccd, - not_sleeping, - axel_joint, - wheels_collision_group, - friction, - CyberWheel, - ExternalForce::default(), - Restitution::new(0.2), - SpatialBundle::default(), - )) - .insert(pbr_bundle.clone()); + + commands.spawn(pbr_bundle.clone()).insert(( + wheel_collider, + mass_props, + wheel_damping, + ccd, + not_sleeping, + axel_joint, + wheels_collision_group, + friction, + CyberWheel, + ExternalForce::default(), + Restitution::new(0.2), + SpatialBundle::default(), + TransformInterpolation::default(), + RigidBody::Dynamic, + )); } }