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_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,
));
}
}