Fixed orientation issue

Former-commit-id: 9fdeadb4c9a9ff55cbdeccbbf97ac32b4e9f4226
This commit is contained in:
Joshua Barretto 2019-04-25 16:04:36 +01:00
parent a66cc98a03
commit 0b0c71592c
5 changed files with 8 additions and 9 deletions

View File

@ -10,7 +10,7 @@ use crate::{
// Basic ECS physics system
pub struct Sys;
const GRAVITY: f32 = 9.81;
const GRAVITY: f32 = 9.81 * 2.0;
impl<'a> System<'a> for Sys {
type SystemData = (
@ -31,12 +31,12 @@ impl<'a> System<'a> for Sys {
// Basic collision with terrain
let mut i = 0;
while terrain
.get(pos.0.map(|e| e as i32))
.get(pos.0.map(|e| e.floor() as i32))
.map(|vox| !vox.is_empty())
.unwrap_or(false) &&
i < 20
i < 80
{
pos.0.z += 0.01;
pos.0.z += 0.005;
vel.0.z = 0.0;
i += 1;
}

View File

@ -67,8 +67,7 @@ impl Animation for IdleAnimation {
next.weapon.ori = Quaternion::rotation_x(2.5);
next.weapon.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
next.torso.offset = Vec3::new(-0.5, 0.0, 0.0);
next.torso.ori = Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0;

View File

@ -67,7 +67,7 @@ impl Animation for RunAnimation {
next.weapon.ori = Quaternion::rotation_x(2.5);
next.weapon.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
next.torso.offset = Vec3::new(-0.5, 0.0, 0.0);
next.torso.ori = Quaternion::rotation_y(0.25 + wavecos * 0.1);
next.torso.scale = Vec3::one() / 11.0;

View File

@ -95,7 +95,7 @@ impl<M> Meshable for Dyna<Block, M> {
.unwrap_or(true)
{
mesh.push_quad(create_quad(
-Vec3::one() + pos.map(|e| e as f32),
offs,
Vec3::unit_x(),
Vec3::unit_z(),
-Vec3::unit_y(),

View File

@ -257,7 +257,7 @@ impl<S: Skeleton> FigureState<S> {
let mat =
Mat4::<f32>::identity() *
Mat4::translation_3d(pos) *
Mat4::rotation_z(dir.y.atan2(dir.x));// + f32//::consts)::PI / 2.0);
Mat4::rotation_z(-dir.x.atan2(dir.y));// + f32//::consts)::PI / 2.0);
let locals = FigureLocals::new(mat);
renderer.update_consts(&mut self.locals, &[locals]).unwrap();