remove dead code

This commit is contained in:
Joe Ardent 2023-02-15 16:15:55 -08:00
parent 14c346eb84
commit fd4155ceab

View file

@ -1,15 +1,15 @@
use bevy::prelude::{shape::UVSphere as Tire, *}; use bevy::prelude::{shape::UVSphere as Tire, *};
use bevy_rapier3d::prelude::{ use bevy_rapier3d::prelude::{
Ccd, Collider, ColliderMassProperties, CollisionGroups, Damping, ExternalForce, Friction, Ccd, CoefficientCombineRule, Collider, ColliderMassProperties, CollisionGroups, Damping,
MultibodyJoint, PrismaticJointBuilder, Restitution, RevoluteJointBuilder, RigidBody, Sleeping, ExternalForce, Friction, MultibodyJoint, PrismaticJointBuilder, Restitution,
TransformInterpolation, RevoluteJointBuilder, RigidBody, Sleeping, TransformInterpolation,
}; };
use super::{CyberWheel, Meshterial, WheelConfig, BIKE_WHEEL_COLLISION_GROUP}; use super::{CyberWheel, Meshterial, WheelConfig, BIKE_WHEEL_COLLISION_GROUP};
pub fn spawn_tires( pub fn spawn_tires(
commands: &mut Commands, commands: &mut Commands,
xform: &Transform, _xform: &Transform,
bike: Entity, bike: Entity,
conf: &WheelConfig, conf: &WheelConfig,
meshterials: &mut Meshterial, meshterials: &mut Meshterial,
@ -47,8 +47,8 @@ pub fn spawn_tires(
}; };
let friction = Friction { let friction = Friction {
coefficient: 0.0, coefficient: 0.8,
..Default::default() combine_rule: CoefficientCombineRule::Min,
}; };
let mut wheel_poses = Vec::with_capacity(2); let mut wheel_poses = Vec::with_capacity(2);
@ -70,22 +70,19 @@ pub fn spawn_tires(
} }
for offset in wheel_poses { 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 { let wheel_damping = Damping {
linear_damping: 0.8, linear_damping: 0.8,
..Default::default() ..Default::default()
}; };
let wheel_collider = Collider::ball(wheel_rad); let wheel_collider = Collider::ball(wheel_rad);
let mass_props = ColliderMassProperties::Density(0.1); let mass_props = ColliderMassProperties::Density(0.1);
let damping = conf.damping; let damping = conf.damping;
let prismatic_builder = PrismaticJointBuilder::new(Vec3::Y) let prismatic_builder = PrismaticJointBuilder::new(Vec3::Y)
.local_anchor1(offset) .local_anchor1(offset)
.limits(limits) .limits(limits)
.motor_position(limits[0], stiffness, damping); .motor_position(limits[0], stiffness, damping);
let prismatic_joint = MultibodyJoint::new(bike, prismatic_builder); let prismatic_joint = MultibodyJoint::new(bike, prismatic_builder);
let fork_rb_entity = commands let fork_rb_entity = commands
.spawn(RigidBody::Dynamic) .spawn(RigidBody::Dynamic)
.insert(prismatic_joint) .insert(prismatic_joint)
@ -93,22 +90,22 @@ pub fn spawn_tires(
let revolute_builder = RevoluteJointBuilder::new(Vec3::X); let revolute_builder = RevoluteJointBuilder::new(Vec3::X);
let axel_joint = MultibodyJoint::new(fork_rb_entity, revolute_builder); let axel_joint = MultibodyJoint::new(fork_rb_entity, revolute_builder);
commands
.spawn(RigidBody::Dynamic) commands.spawn(pbr_bundle.clone()).insert((
.insert(( wheel_collider,
wheel_collider, mass_props,
mass_props, wheel_damping,
wheel_damping, ccd,
ccd, not_sleeping,
not_sleeping, axel_joint,
axel_joint, wheels_collision_group,
wheels_collision_group, friction,
friction, CyberWheel,
CyberWheel, ExternalForce::default(),
ExternalForce::default(), Restitution::new(0.2),
Restitution::new(0.2), SpatialBundle::default(),
SpatialBundle::default(), TransformInterpolation::default(),
)) RigidBody::Dynamic,
.insert(pbr_bundle.clone()); ));
} }
} }