Fixed sliding when wielding

This commit is contained in:
Joshua Barretto
2021-03-15 14:18:56 +00:00
parent c0de8c851b
commit 0312c06295

View File

@ -602,7 +602,9 @@ impl FigureMgr {
.join() .join()
.enumerate() .enumerate()
{ {
let vel = (anim::vek::Vec3::<f32>::from(vel.0),); // Velocity relative to the current ground
let rel_vel = anim::vek::Vec3::<f32>::from(vel.0 - physics.ground_vel);
let look_dir = controller let look_dir = controller
.map(|c| c.inputs.look_dir) .map(|c| c.inputs.look_dir)
.unwrap_or(Dir::default()); .unwrap_or(Dir::default());
@ -744,9 +746,6 @@ impl FigureMgr {
let hands = (active_tool_hand, second_tool_hand); let hands = (active_tool_hand, second_tool_hand);
// Velocity relative to the current ground
let rel_vel = vel.0 - physics.ground_vel;
match body { match body {
Body::Humanoid(body) => { Body::Humanoid(body) => {
let (model, skeleton_attr) = self.model_cache.get_or_create_model( let (model, skeleton_attr) = self.model_cache.get_or_create_model(
@ -1131,7 +1130,7 @@ impl FigureMgr {
active_tool_kind, active_tool_kind,
second_tool_kind, second_tool_kind,
time, time,
vel.0.magnitude(), rel_vel.magnitude(),
Some(s.stage_section), Some(s.stage_section),
), ),
stage_progress, stage_progress,
@ -1310,7 +1309,7 @@ impl FigureMgr {
active_tool_kind, active_tool_kind,
second_tool_kind, second_tool_kind,
time, time,
vel.0.magnitude(), rel_vel.magnitude(),
Some(s.stage_section), Some(s.stage_section),
), ),
stage_progress, stage_progress,
@ -2816,7 +2815,7 @@ impl FigureMgr {
&target_base, &target_base,
( (
active_tool_kind, active_tool_kind,
vel.0, rel_vel,
ori * anim::vek::Vec3::<f32>::unit_y(), ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(), state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
time, time,
@ -3225,7 +3224,7 @@ impl FigureMgr {
anim::theropod::DashAnimation::update_skeleton( anim::theropod::DashAnimation::update_skeleton(
&target_base, &target_base,
( (
vel.0.magnitude(), rel_vel.magnitude(),
time, time,
Some(s.stage_section), Some(s.stage_section),
state.state_time, state.state_time,