checkpoint with capsule wheel colliders

This commit is contained in:
Joe Ardent 2023-02-05 14:29:05 -08:00
parent 37ce29fd71
commit db34880c1e

View file

@ -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::{ use bevy_rapier3d::prelude::{
Ccd, CoefficientCombineRule, Collider, ColliderMassProperties, CollisionGroups, Damping, Ccd, CoefficientCombineRule, Collider, ColliderMassProperties, CollisionGroups, Damping,
ExternalForce, Friction, MultibodyJoint, PrismaticJointBuilder, Restitution, ExternalForce, Friction, LockedAxes, MultibodyJoint, PrismaticJointBuilder, Restitution,
RevoluteJointBuilder, RigidBody, Sleeping, TransformInterpolation, RevoluteJointBuilder, RigidBody, Sleeping, TransformInterpolation,
}; };
@ -79,7 +82,7 @@ pub fn spawn_tires(
linear_damping: 0.8, linear_damping: 0.8,
..Default::default() ..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 mass_props = ColliderMassProperties::Density(0.1);
let damping = conf.damping; let damping = conf.damping;
@ -111,7 +114,7 @@ pub fn spawn_tires(
commands.entity(sentity).insert(steering); commands.entity(sentity).insert(steering);
} }
let revolute = RevoluteJointBuilder::new(Vec3::X); let revolute = RevoluteJointBuilder::new(Vec3::Y);
let axel = MultibodyJoint::new(sentity, revolute); let axel = MultibodyJoint::new(sentity, revolute);
let wheel_bundle = ( let wheel_bundle = (
wheel_collider, wheel_collider,