Fix collider cube sizes, and more aggressively clear velocity.

This commit is contained in:
Nolan Darilek 2021-06-04 07:34:58 -05:00
parent ee751fbb74
commit 72c647385a

View File

@ -7,7 +7,7 @@ use bevy_tts::Tts;
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use crate::{ use crate::{
core::{Angle, CardinalDirection, Coordinates, Player, PointLike}, core::{Angle, CardinalDirection, Player, PointLike},
error::error_handler, error::error_handler,
exploration::{ExplorationFocused, Exploring}, exploration::{ExplorationFocused, Exploring},
map::{ITileType, Map}, map::{ITileType, Map},
@ -56,7 +56,7 @@ fn add_map_colliders(mut commands: Commands, maps: Query<(Entity, &Map), Added<M
let tile = map.base.at(x, y); let tile = map.base.at(x, y);
if tile.blocks_motion() { if tile.blocks_motion() {
let collider = ColliderBundle { let collider = ColliderBundle {
shape: ColliderShape::cuboid(1., 1.), shape: ColliderShape::cuboid(0.5, 0.5),
..Default::default() ..Default::default()
}; };
let collider_parent = ColliderParent { let collider_parent = ColliderParent {
@ -186,7 +186,6 @@ fn movement_controls<S, A: 'static>(
if let Some(strength) = strength { if let Some(strength) = strength {
direction *= strength; direction *= strength;
} }
//direction = transform.compute_matrix().transform_vector3(direction);
let mut v: Vector<Real> = (direction * **speed).into(); let mut v: Vector<Real> = (direction * **speed).into();
v = position.position.rotation.transform_vector(&v); v = position.position.rotation.transform_vector(&v);
velocity.linvel = v; velocity.linvel = v;
@ -197,6 +196,7 @@ fn movement_controls<S, A: 'static>(
} else if sprinting { } else if sprinting {
**speed = **max_speed; **speed = **max_speed;
} else { } else {
velocity.linvel = Vec2::ZERO.into();
**speed = **max_speed / 3.; **speed = **max_speed / 3.;
} }
} }