Fail at adding joints, rename geometry module.
Time to move the dynamic geo into its own sitch.
This commit is contained in:
parent
b6fa54a99c
commit
10b9414989
8 changed files with 86 additions and 15 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -740,9 +740,9 @@ checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
|
|||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.7.3"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f"
|
||||
checksum = "0e851ca7c24871e7336801608a4797d7376545b6928a10d32d75685687141ead"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
@ -2635,9 +2635,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
|
|
@ -3,7 +3,7 @@ use bevy::{
|
|||
render::camera::{ActiveCameras, Camera, CameraPlugin},
|
||||
};
|
||||
|
||||
use crate::{geometry::CyberBikeModel, input::InputState};
|
||||
use crate::{input::InputState, static_geometry::CyberBikeModel};
|
||||
|
||||
// 85 degrees in radians
|
||||
const MAX_PITCH: f32 = 1.48353;
|
||||
|
|
|
@ -4,7 +4,7 @@ use bevy::{
|
|||
};
|
||||
use bevy_rapier3d::prelude::*;
|
||||
|
||||
use crate::geometry::{CyberBikeModel, CyberPlanet, PLANET_RADIUS, SPAWN_ALTITUDE};
|
||||
use crate::static_geometry::{CyberBikeModel, CyberPlanet, PLANET_RADIUS, SPAWN_ALTITUDE};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct CyberBikeBody;
|
||||
|
@ -67,7 +67,7 @@ fn setup_colliders(
|
|||
.insert_bundle(pbody)
|
||||
.insert_bundle(pcollide);
|
||||
|
||||
// bike is the easy part
|
||||
// bike
|
||||
let (bike, xform) = bike_query.single();
|
||||
setup_bike_collider(bike, xform, &mut commands);
|
||||
}
|
||||
|
@ -89,10 +89,11 @@ fn setup_bike_collider(bike: Entity, xform: &Transform, commands: &mut Commands)
|
|||
|
||||
let isometry = Isometry::from_parts(xform.translation.into(), xform.rotation.into());
|
||||
bbody.position = isometry.into();
|
||||
|
||||
// collider
|
||||
let shape = ColliderShape::capsule(
|
||||
Vec3::new(0.0, 0.0, -2.7).into(),
|
||||
Vec3::new(0.0, 0.0, 2.0).into(),
|
||||
Vec3::new(0.0, 0.0, 2.5).into(),
|
||||
1.0,
|
||||
);
|
||||
let bcollide = ColliderBundle {
|
||||
|
@ -110,15 +111,85 @@ fn setup_bike_collider(bike: Entity, xform: &Transform, commands: &mut Commands)
|
|||
.entity(bike)
|
||||
.insert_bundle(bbody)
|
||||
.insert(CyberBikeBody)
|
||||
.insert(RigidBodyPositionSync::Discrete)
|
||||
.with_children(|e| {
|
||||
e.spawn_bundle(bcollide)
|
||||
.insert(RigidBodyPositionSync::Interpolated { prev_pos: None })
|
||||
.with_children(|child_builder| {
|
||||
child_builder
|
||||
.spawn_bundle(bcollide)
|
||||
.insert(ColliderDebugRender {
|
||||
color: Color::GREEN,
|
||||
})
|
||||
.insert(CyberBikeCollider)
|
||||
.insert(ColliderPositionSync::Discrete);
|
||||
});
|
||||
|
||||
/* {
|
||||
let wheel_collider = ColliderBundle {
|
||||
material: ColliderMaterial::new(0.0, 0.0).into(),
|
||||
shape: ColliderShape::ball(0.25).into(),
|
||||
mass_properties: ColliderMassProps::Density(0.1).into(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let shock = PrismaticJoint::new(Vector::y_axis())
|
||||
.local_anchor1(Vec3::new(-3.0, -3.0, -3.0).into())
|
||||
.motor_position(-1.0, 0.02, 0.5);
|
||||
|
||||
let ccd = RigidBodyCcd {
|
||||
ccd_enabled: true,
|
||||
ccd_thickness: 0.1,
|
||||
ccd_max_dist: 0.25,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut fw_pos = Isometry::default();
|
||||
fw_pos.translation =
|
||||
(xform.translation + (xform.down() * 4.5 + (xform.forward() * 2.5))).into();
|
||||
|
||||
let front_wheel_body = RigidBodyBundle {
|
||||
//activation: RigidBodyActivation::cannot_sleep().into(),
|
||||
//ccd: ccd.into(),
|
||||
position: fw_pos.into(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let front_wheel = commands
|
||||
.spawn_bundle(front_wheel_body)
|
||||
.insert_bundle(wheel_collider)
|
||||
.insert(ColliderPositionSync::Discrete)
|
||||
.insert(ColliderDebugRender::from(Color::YELLOW))
|
||||
.id();
|
||||
|
||||
//commands.spawn_bundle((JointBuilderComponent::new(shock, bike, front_wheel),));
|
||||
|
||||
// let bw_pos = Isometry::new(
|
||||
// (xform.translation + xform.down() + xform.back() * 2.0).into(),
|
||||
// Vec3::ZERO.into(),
|
||||
// );
|
||||
|
||||
// let back_wheel_body = RigidBodyBundle {
|
||||
// activation: RigidBodyActivation::cannot_sleep().into(),
|
||||
// ccd: ccd.into(),
|
||||
// position: bw_pos.into(),
|
||||
// ..Default::default()
|
||||
// };
|
||||
|
||||
// let wheel_collider = ColliderBundle {
|
||||
// material: ColliderMaterial::new(0.0, 0.0).into(),
|
||||
// // default shape is a 1-meter ball
|
||||
// ..Default::default()
|
||||
// };
|
||||
|
||||
// let back_wheel = commands
|
||||
// .spawn_bundle(back_wheel_body)
|
||||
// .insert_bundle(wheel_collider)
|
||||
// .insert(ColliderPositionSync::Discrete)
|
||||
// .insert(ColliderDebugRender::from(Color::RED))
|
||||
// .id();
|
||||
|
||||
//commands.spawn_bundle((JointBuilderComponent::new(shock, bike,
|
||||
// back_wheel),));
|
||||
|
||||
}; */
|
||||
}
|
||||
|
||||
pub struct CyberCollidersPlugin;
|
||||
|
|
|
@ -10,7 +10,7 @@ use bevy::{
|
|||
use bevy_polyline::{Polyline, PolylineBundle, PolylineMaterial, PolylinePlugin};
|
||||
use rand::{thread_rng, Rng};
|
||||
|
||||
use crate::{geometry::CyberPlanet, lights::AnimateCyberLightWireframe};
|
||||
use crate::{lights::AnimateCyberLightWireframe, static_geometry::CyberPlanet};
|
||||
|
||||
pub const BISEXY_COLOR: Color = Color::hsla(292.0, 0.9, 0.60, 1.1);
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ use bevy::{
|
|||
pub mod action;
|
||||
pub mod camera;
|
||||
pub mod colliders;
|
||||
pub mod geometry;
|
||||
pub mod glamor;
|
||||
pub mod input;
|
||||
pub mod lights;
|
||||
pub mod static_geometry;
|
||||
pub mod ui;
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, SystemLabel, StageLabel)]
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::f32::consts::TAU;
|
|||
use bevy::prelude::*;
|
||||
use rand::prelude::*;
|
||||
|
||||
use crate::geometry::PLANET_RADIUS;
|
||||
use crate::static_geometry::PLANET_RADIUS;
|
||||
|
||||
pub const LIGHT_RANGE: f32 = 90.0;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use cyber_rider::{
|
|||
camera::CyberCamPlugin,
|
||||
colliders::CyberCollidersPlugin,
|
||||
disable_mouse_trap,
|
||||
geometry::CyberGeomPlugin,
|
||||
static_geometry::CyberGeomPlugin,
|
||||
glamor::CyberGlamorPlugin,
|
||||
input::CyberInputPlugin,
|
||||
lights::CyberSpaceLightsPlugin,
|
||||
|
|
Loading…
Reference in a new issue