From db34880c1e4f46b3b04df17f933ae8f7ae418fbb Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sun, 5 Feb 2023 14:29:05 -0800 Subject: [PATCH] checkpoint with capsule wheel colliders --- src/bike/wheels.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bike/wheels.rs b/src/bike/wheels.rs index 82e5be0..2cb71ce 100644 --- a/src/bike/wheels.rs +++ b/src/bike/wheels.rs @@ -1,7 +1,10 @@ -use bevy::prelude::{shape::UVSphere as Tire, *}; +use bevy::prelude::{ + shape::Capsule as Tire, AlphaMode, BuildChildren, Color, Commands, Entity, Mesh, PbrBundle, + Quat, SpatialBundle, StandardMaterial, Transform, Vec3, +}; use bevy_rapier3d::prelude::{ Ccd, CoefficientCombineRule, Collider, ColliderMassProperties, CollisionGroups, Damping, - ExternalForce, Friction, MultibodyJoint, PrismaticJointBuilder, Restitution, + ExternalForce, Friction, LockedAxes, MultibodyJoint, PrismaticJointBuilder, Restitution, RevoluteJointBuilder, RigidBody, Sleeping, TransformInterpolation, }; @@ -79,7 +82,7 @@ pub fn spawn_tires( linear_damping: 0.8, ..Default::default() }; - let wheel_collider = Collider::ball(wheel_rad); + let wheel_collider = Collider::capsule(-Vec3::Y, Vec3::Y, 0.3); let mass_props = ColliderMassProperties::Density(0.1); let damping = conf.damping; @@ -111,7 +114,7 @@ pub fn spawn_tires( commands.entity(sentity).insert(steering); } - let revolute = RevoluteJointBuilder::new(Vec3::X); + let revolute = RevoluteJointBuilder::new(Vec3::Y); let axel = MultibodyJoint::new(sentity, revolute); let wheel_bundle = ( wheel_collider,