Merge branch 'smoothland'

This adds rake and trail to the front, as well as increases the density/mass of the wheels, while
adding that parameter to the WheelConfig.
This commit is contained in:
Joe Ardent 2023-02-18 22:00:50 -08:00
commit faafb18e44
3 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,6 @@ pub struct CyberWheel;
#[reflect(Resource)]
pub struct WheelConfig {
pub front_forward: f32,
pub front_stance: f32,
pub rear_back: f32,
pub y: f32,
pub limits: [f32; 2],
@ -25,13 +24,13 @@ pub struct WheelConfig {
pub radius: f32,
pub friction: f32,
pub restitution: f32,
pub density: f32,
}
impl Default for WheelConfig {
fn default() -> Self {
Self {
front_forward: 0.9,
front_stance: 0.65,
front_forward: 0.8,
rear_back: 1.1,
y: -0.1,
limits: [-0.7, 0.1],
@ -40,6 +39,7 @@ impl Default for WheelConfig {
radius: 0.3,
friction: 0.9,
restitution: 0.8,
density: 0.9,
}
}
}

View File

@ -75,7 +75,7 @@ pub fn spawn_tires(
..Default::default()
};
let wheel_collider = Collider::ball(wheel_rad);
let mass_props = ColliderMassProperties::Density(0.1);
let mass_props = ColliderMassProperties::Density(conf.density);
let damping = conf.damping;
let prismatic_axis = if steering.is_some() {
@ -96,7 +96,8 @@ pub fn spawn_tires(
.id();
let axel_parent_entity = if let Some(steering) = steering {
let neck_builder = RevoluteJointBuilder::new(Vec3::Y);
let neck_builder =
RevoluteJointBuilder::new(Vec3::Y).local_anchor1(Vec3::new(0.0, 0.0, 0.1));
let neck_joint = MultibodyJoint::new(fork_rb_entity, neck_builder);
let neck = commands
.spawn(RigidBody::Dynamic)

View File

@ -5,10 +5,13 @@ use cyber_rider::{
planet::CyberPlanetPlugin, ui::CyberUIPlugin,
};
const CYBER_SKY: Color = Color::rgb(0.07, 0.001, 0.02);
// const CYBER_SKY: Color = Color::rgb(0.64, 0.745, 0.937);
fn main() {
let mut app = App::new();
app.insert_resource(Msaa { samples: 4 })
.insert_resource(ClearColor(Color::rgb(0.07, 0.001, 0.02)))
.insert_resource(ClearColor(CYBER_SKY))
.add_plugins(DefaultPlugins.set(WindowPlugin {
window: WindowDescriptor {
width: 2560.0,