mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'tygyh/Resolve-all-'#-allow(clippy--approx_constant)]'-error-supressions' into 'master'
Resolve all '#[allow(clippy::approx_constant)]' error supressions See merge request veloren/veloren!2608
This commit is contained in:
commit
eb08b6a153
@ -8,6 +8,7 @@ use image::{ImageBuffer, ImageDecoder, Pixel};
|
|||||||
use num_traits::cast::FromPrimitive;
|
use num_traits::cast::FromPrimitive;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
|
f64::consts::TAU,
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
@ -178,6 +179,7 @@ impl<'a, VIE: VoxelImageEncoding> VoxelImageEncoding for &'a VIE {
|
|||||||
|
|
||||||
fn finish(ws: &Self::Workspace) -> Option<Self::Output> { VIE::finish(ws) }
|
fn finish(ws: &Self::Workspace) -> Option<Self::Output> { VIE::finish(ws) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, VIE: VoxelImageDecoding> VoxelImageDecoding for &'a VIE {
|
impl<'a, VIE: VoxelImageDecoding> VoxelImageDecoding for &'a VIE {
|
||||||
fn start(ws: &Self::Output) -> Option<Self::Workspace> { VIE::start(ws) }
|
fn start(ws: &Self::Output) -> Option<Self::Workspace> { VIE::start(ws) }
|
||||||
|
|
||||||
@ -185,6 +187,7 @@ impl<'a, VIE: VoxelImageDecoding> VoxelImageDecoding for &'a VIE {
|
|||||||
VIE::get_block(ws, x, y, is_border)
|
VIE::get_block(ws, x, y, is_border)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub struct QuadPngEncoding<const RESOLUTION_DIVIDER: u32>();
|
pub struct QuadPngEncoding<const RESOLUTION_DIVIDER: u32>();
|
||||||
|
|
||||||
@ -270,7 +273,7 @@ impl<const N: u32> VoxelImageEncoding for QuadPngEncoding<N> {
|
|||||||
/// yet)
|
/// yet)
|
||||||
const fn sin(x: f64) -> f64 {
|
const fn sin(x: f64) -> f64 {
|
||||||
use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
let mut x = (x - PI * 0.5) % (PI * 2.0);
|
let mut x = (x - PI * 0.5) % (TAU);
|
||||||
x = if x < 0.0 { -x } else { x } - PI;
|
x = if x < 0.0 { -x } else { x } - PI;
|
||||||
x = if x < 0.0 { -x } else { x } - PI * 0.5;
|
x = if x < 0.0 { -x } else { x } - PI * 0.5;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use rand::{seq::SliceRandom, thread_rng};
|
use rand::{seq::SliceRandom, thread_rng};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::f32::consts::FRAC_PI_6;
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
make_case_elim!(
|
make_case_elim!(
|
||||||
@ -302,9 +303,7 @@ impl Body {
|
|||||||
Body::Bedroll => 3.0,
|
Body::Bedroll => 3.0,
|
||||||
Body::Bench => 100.0,
|
Body::Bench => 100.0,
|
||||||
Body::BoltFire | Body::BoltFireBig | Body::BoltNature => 1.0,
|
Body::BoltFire | Body::BoltFireBig | Body::BoltNature => 1.0,
|
||||||
Body::Bomb => {
|
Body::Bomb => 0.5 * IRON_DENSITY * FRAC_PI_6 * self.dimensions().x.powi(3),
|
||||||
0.5 * IRON_DENSITY * std::f32::consts::PI / 6.0 * self.dimensions().x.powi(3)
|
|
||||||
},
|
|
||||||
Body::Campfire | Body::CampfireLit => 300.0,
|
Body::Campfire | Body::CampfireLit => 300.0,
|
||||||
Body::Carpet
|
Body::Carpet
|
||||||
| Body::CarpetHumanRound
|
| Body::CarpetHumanRound
|
||||||
|
@ -5,6 +5,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use rand::prelude::SliceRandom;
|
use rand::prelude::SliceRandom;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::f32::consts::FRAC_PI_6;
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
pub const ALL_BODIES: [Body; 2] = [Body::DefaultAirship, Body::AirBalloon];
|
pub const ALL_BODIES: [Body; 2] = [Body::DefaultAirship, Body::AirBalloon];
|
||||||
@ -46,9 +47,8 @@ impl Body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn balloon_vol(&self) -> f32 {
|
fn balloon_vol(&self) -> f32 {
|
||||||
let spheroid_vol = |equat_d: f32, polar_d: f32| -> f32 {
|
let spheroid_vol =
|
||||||
(std::f32::consts::PI / 6.0) * equat_d.powi(2) * polar_d
|
|equat_d: f32, polar_d: f32| -> f32 { FRAC_PI_6 * equat_d.powi(2) * polar_d };
|
||||||
};
|
|
||||||
let dim = self.dimensions();
|
let dim = self.dimensions();
|
||||||
spheroid_vol(dim.z, dim.y)
|
spheroid_vol(dim.z, dim.y)
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ impl Body {
|
|||||||
// height from bottom of keel to deck
|
// height from bottom of keel to deck
|
||||||
let deck_height = 10_f32;
|
let deck_height = 10_f32;
|
||||||
let dim = self.dimensions();
|
let dim = self.dimensions();
|
||||||
(std::f32::consts::PI / 6.0) * (deck_height * 1.5).powi(2) * dim.y
|
FRAC_PI_6 * (deck_height * 1.5).powi(2) * dim.y
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hull_density(&self) -> Density {
|
pub fn hull_density(&self) -> Density {
|
||||||
|
@ -6,7 +6,7 @@ use crate::{
|
|||||||
util::{Dir, Plane, Projection},
|
util::{Dir, Plane, Projection},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_4, FRAC_PI_6, PI};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -300,7 +300,7 @@ impl Body {
|
|||||||
_ => {
|
_ => {
|
||||||
let dim = self.dimensions();
|
let dim = self.dimensions();
|
||||||
const CD: f32 = 2.0;
|
const CD: f32 = 2.0;
|
||||||
CD * (PI / 6.0 * dim.x * dim.y * dim.z).powf(2.0 / 3.0)
|
CD * (FRAC_PI_6 * dim.x * dim.y * dim.z).powf(2.0 / 3.0)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ impl Body {
|
|||||||
// Airships tend to use the square of the cube root of its volume for
|
// Airships tend to use the square of the cube root of its volume for
|
||||||
// reference area
|
// reference area
|
||||||
let dim = self.dimensions();
|
let dim = self.dimensions();
|
||||||
(PI / 6.0 * dim.x * dim.y * dim.z).powf(2.0 / 3.0)
|
(FRAC_PI_6 * dim.x * dim.y * dim.z).powf(2.0 / 3.0)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ impl Body {
|
|||||||
pub fn angle_of_attack(ori: &Ori, rel_flow_dir: &Dir) -> f32 {
|
pub fn angle_of_attack(ori: &Ori, rel_flow_dir: &Dir) -> f32 {
|
||||||
rel_flow_dir
|
rel_flow_dir
|
||||||
.projected(&Plane::from(ori.right()))
|
.projected(&Plane::from(ori.right()))
|
||||||
.map(|flow_dir| PI / 2.0 - ori.up().angle_between(flow_dir.to_vec()))
|
.map(|flow_dir| FRAC_PI_2 - ori.up().angle_between(flow_dir.to_vec()))
|
||||||
.unwrap_or(0.0)
|
.unwrap_or(0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ pub fn lift_coefficient(aspect_ratio: f32, planform_area: f32, aoa: f32) -> f32
|
|||||||
// to just throw your hands up and return 0
|
// to just throw your hands up and return 0
|
||||||
let aoa_s = aoa.signum();
|
let aoa_s = aoa.signum();
|
||||||
let c_l_max = lift_slope(aspect_ratio, None) * stall_angle;
|
let c_l_max = lift_slope(aspect_ratio, None) * stall_angle;
|
||||||
let deg_45 = PI / 4.0;
|
let deg_45 = FRAC_PI_4;
|
||||||
if aoa_abs < deg_45 {
|
if aoa_abs < deg_45 {
|
||||||
// drop directly to 0.6 * max lift at stall angle
|
// drop directly to 0.6 * max lift at stall angle
|
||||||
// then climb back to max at 45°
|
// then climb back to max at 45°
|
||||||
|
@ -2,7 +2,7 @@ use crate::util::{Dir, Plane, Projection};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::Component;
|
use specs::Component;
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
use vek::{Quaternion, Vec2, Vec3};
|
use vek::{Quaternion, Vec2, Vec3};
|
||||||
|
|
||||||
// Orientation
|
// Orientation
|
||||||
@ -50,13 +50,13 @@ impl Ori {
|
|||||||
/// Look direction (as a Dir it is pedantically normalized)
|
/// Look direction (as a Dir it is pedantically normalized)
|
||||||
pub fn look_dir(&self) -> Dir { self.to_quat() * Dir::default() }
|
pub fn look_dir(&self) -> Dir { self.to_quat() * Dir::default() }
|
||||||
|
|
||||||
pub fn up(&self) -> Dir { self.pitched_up(PI / 2.0).look_dir() }
|
pub fn up(&self) -> Dir { self.pitched_up(FRAC_PI_2).look_dir() }
|
||||||
|
|
||||||
pub fn down(&self) -> Dir { self.pitched_down(PI / 2.0).look_dir() }
|
pub fn down(&self) -> Dir { self.pitched_down(FRAC_PI_2).look_dir() }
|
||||||
|
|
||||||
pub fn left(&self) -> Dir { self.yawed_left(PI / 2.0).look_dir() }
|
pub fn left(&self) -> Dir { self.yawed_left(FRAC_PI_2).look_dir() }
|
||||||
|
|
||||||
pub fn right(&self) -> Dir { self.yawed_right(PI / 2.0).look_dir() }
|
pub fn right(&self) -> Dir { self.yawed_right(FRAC_PI_2).look_dir() }
|
||||||
|
|
||||||
pub fn slerp(ori1: Self, ori2: Self, s: f32) -> Self {
|
pub fn slerp(ori1: Self, ori2: Self, s: f32) -> Self {
|
||||||
Self(Quaternion::slerp(ori1.0, ori2.0, s).normalized())
|
Self(Quaternion::slerp(ori1.0, ori2.0, s).normalized())
|
||||||
@ -329,6 +329,7 @@ impl Component for Ori {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::f32::consts::TAU;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn from_to_dir() {
|
fn from_to_dir() {
|
||||||
@ -341,7 +342,7 @@ mod tests {
|
|||||||
|
|
||||||
let angles = 32;
|
let angles = 32;
|
||||||
for i in 0..angles {
|
for i in 0..angles {
|
||||||
let theta = PI * 2. * (i as f32) / (angles as f32);
|
let theta = TAU * (i as f32) / (angles as f32);
|
||||||
let v = Vec3::unit_y();
|
let v = Vec3::unit_y();
|
||||||
let q = Quaternion::rotation_x(theta);
|
let q = Quaternion::rotation_x(theta);
|
||||||
from_to(Dir::new(q * v));
|
from_to(Dir::new(q * v));
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
util::{Dir, Plane, Projection},
|
util::{Dir, Plane, Projection},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
const PITCH_SLOW_TIME: f32 = 0.5;
|
const PITCH_SLOW_TIME: f32 = 0.5;
|
||||||
@ -53,7 +53,7 @@ impl Data {
|
|||||||
};
|
};
|
||||||
let look_ori = Ori::from(data.inputs.look_dir);
|
let look_ori = Ori::from(data.inputs.look_dir);
|
||||||
look_ori
|
look_ori
|
||||||
.yawed_right(PI / 3.0 * look_ori.right().xy().dot(move_dir))
|
.yawed_right(FRAC_PI_3 * look_ori.right().xy().dot(move_dir))
|
||||||
.pitched_up(PI * 0.04)
|
.pitched_up(PI * 0.04)
|
||||||
.pitched_down(
|
.pitched_down(
|
||||||
data.inputs
|
data.inputs
|
||||||
@ -150,7 +150,7 @@ impl CharacterBehavior for Data {
|
|||||||
air_flow.0.magnitude_squared().min(40_f32.powi(2)) / 40_f32.powi(2);
|
air_flow.0.magnitude_squared().min(40_f32.powi(2)) / 40_f32.powi(2);
|
||||||
|
|
||||||
Quaternion::rotation_3d(
|
Quaternion::rotation_3d(
|
||||||
-PI / 2.0 * speed_factor,
|
-FRAC_PI_2 * speed_factor,
|
||||||
ori.up()
|
ori.up()
|
||||||
.cross(air_flow.0)
|
.cross(air_flow.0)
|
||||||
.try_normalized()
|
.try_normalized()
|
||||||
@ -163,7 +163,7 @@ impl CharacterBehavior for Data {
|
|||||||
let accel_factor = accel.magnitude_squared().min(1.0) / 1.0;
|
let accel_factor = accel.magnitude_squared().min(1.0) / 1.0;
|
||||||
|
|
||||||
Quaternion::rotation_3d(
|
Quaternion::rotation_3d(
|
||||||
PI / 2.0
|
FRAC_PI_2
|
||||||
* accel_factor
|
* accel_factor
|
||||||
* if data.physics.on_ground.is_some() {
|
* if data.physics.on_ground.is_some() {
|
||||||
-1.0
|
-1.0
|
||||||
|
@ -16,11 +16,13 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
|
f32::consts::PI,
|
||||||
ops::{Add, Div},
|
ops::{Add, Div},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use strum_macros::Display;
|
use strum_macros::Display;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
pub const MOVEMENT_THRESHOLD_VEL: f32 = 3.0;
|
pub const MOVEMENT_THRESHOLD_VEL: f32 = 3.0;
|
||||||
|
|
||||||
impl Body {
|
impl Body {
|
||||||
@ -351,7 +353,7 @@ pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, efficiency:
|
|||||||
{
|
{
|
||||||
let rate = {
|
let rate = {
|
||||||
let angle = update.ori.look_dir().angle_between(*dir);
|
let angle = update.ori.look_dir().angle_between(*dir);
|
||||||
data.body.base_ori_rate() * efficiency * std::f32::consts::PI / angle
|
data.body.base_ori_rate() * efficiency * PI / angle
|
||||||
};
|
};
|
||||||
update.ori = update
|
update.ori = update
|
||||||
.ori
|
.ori
|
||||||
|
@ -50,6 +50,7 @@ use world::util::Sampler;
|
|||||||
|
|
||||||
use crate::{client::Client, login_provider::LoginProvider, wiring};
|
use crate::{client::Client, login_provider::LoginProvider, wiring};
|
||||||
use scan_fmt::{scan_fmt, scan_fmt_some};
|
use scan_fmt::{scan_fmt, scan_fmt_some};
|
||||||
|
use std::f32::consts::PI;
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
pub trait ChatCommandExt {
|
pub trait ChatCommandExt {
|
||||||
@ -1149,7 +1150,7 @@ fn handle_spawn_airship(
|
|||||||
let mut pos = position(server, target, "target")?;
|
let mut pos = position(server, target, "target")?;
|
||||||
pos.0.z += 50.0;
|
pos.0.z += 50.0;
|
||||||
const DESTINATION_RADIUS: f32 = 2000.0;
|
const DESTINATION_RADIUS: f32 = 2000.0;
|
||||||
let angle = angle.map(|a| a * std::f32::consts::PI / 180.0);
|
let angle = angle.map(|a| a * PI / 180.0);
|
||||||
let destination = angle.map(|a| {
|
let destination = angle.map(|a| {
|
||||||
pos.0
|
pos.0
|
||||||
+ Vec3::new(
|
+ Vec3::new(
|
||||||
|
@ -7,7 +7,7 @@ use common::{
|
|||||||
terrain::TerrainGrid,
|
terrain::TerrainGrid,
|
||||||
};
|
};
|
||||||
use rand_distr::{Distribution, Normal};
|
use rand_distr::{Distribution, Normal};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
use world::{
|
use world::{
|
||||||
civ::{Site, Track},
|
civ::{Site, Track},
|
||||||
@ -156,7 +156,7 @@ impl Entity {
|
|||||||
let offset_dir = (offset_site_pos - self.pos.xy()).normalized();
|
let offset_dir = (offset_site_pos - self.pos.xy()).normalized();
|
||||||
let dist = (offset_site_pos - self.pos.xy()).magnitude();
|
let dist = (offset_site_pos - self.pos.xy()).magnitude();
|
||||||
let midpoint = self.pos.xy() + offset_dir * (dist / 2.0);
|
let midpoint = self.pos.xy() + offset_dir * (dist / 2.0);
|
||||||
let perp_dir = offset_dir.rotated_z(PI / 2.0);
|
let perp_dir = offset_dir.rotated_z(FRAC_PI_2);
|
||||||
let offset = normaloff.sample(&mut rng);
|
let offset = normaloff.sample(&mut rng);
|
||||||
let inbetween_pos = midpoint + (perp_dir * offset);
|
let inbetween_pos = midpoint + (perp_dir * offset);
|
||||||
|
|
||||||
|
@ -46,7 +46,11 @@ use specs::{
|
|||||||
Entities, Entity as EcsEntity, Join, ParJoin, Read, ReadExpect, ReadStorage, SystemData, World,
|
Entities, Entity as EcsEntity, Join, ParJoin, Read, ReadExpect, ReadStorage, SystemData, World,
|
||||||
Write, WriteExpect, WriteStorage,
|
Write, WriteExpect, WriteStorage,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, sync::Arc, time::Duration};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, PI},
|
||||||
|
sync::Arc,
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
struct AgentData<'a> {
|
struct AgentData<'a> {
|
||||||
@ -2328,7 +2332,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller.inputs.move_dir = bearing
|
controller.inputs.move_dir = bearing
|
||||||
.xy()
|
.xy()
|
||||||
.rotated_z(thread_rng().gen_range(0.5..1.57))
|
.rotated_z(thread_rng().gen_range(0.5..FRAC_PI_2))
|
||||||
.try_normalized()
|
.try_normalized()
|
||||||
.unwrap_or_else(Vec2::zero)
|
.unwrap_or_else(Vec2::zero)
|
||||||
* speed;
|
* speed;
|
||||||
@ -2425,7 +2429,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller.inputs.move_dir = bearing
|
controller.inputs.move_dir = bearing
|
||||||
.xy()
|
.xy()
|
||||||
.rotated_z(thread_rng().gen_range(-1.57..-0.5))
|
.rotated_z(thread_rng().gen_range(-FRAC_PI_2..-0.5))
|
||||||
.try_normalized()
|
.try_normalized()
|
||||||
.unwrap_or_else(Vec2::zero)
|
.unwrap_or_else(Vec2::zero)
|
||||||
* speed;
|
* speed;
|
||||||
@ -2549,7 +2553,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller.inputs.move_dir = bearing
|
controller.inputs.move_dir = bearing
|
||||||
.xy()
|
.xy()
|
||||||
.rotated_z(thread_rng().gen_range(0.5..1.57))
|
.rotated_z(thread_rng().gen_range(0.5..FRAC_PI_2))
|
||||||
.try_normalized()
|
.try_normalized()
|
||||||
.unwrap_or_else(Vec2::zero)
|
.unwrap_or_else(Vec2::zero)
|
||||||
* speed;
|
* speed;
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::tool::{AbilitySpec, ToolKind},
|
comp::item::tool::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
@ -27,7 +27,6 @@ impl Animation for AlphaAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_alpha\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_alpha\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_alpha")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_alpha")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
@ -109,7 +108,7 @@ impl Animation for AlphaAnimation {
|
|||||||
next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.5 + move2 * -0.7);
|
next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.5 + move2 * -0.7);
|
||||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.7);
|
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.7);
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move1 * -0.5 + move2 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_2 + move1 * -0.5 + move2 * 1.5)
|
||||||
* Quaternion::rotation_y(-0.2);
|
* Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
|
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
|
||||||
@ -135,8 +134,8 @@ impl Animation for AlphaAnimation {
|
|||||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.2 + move2 * 0.2);
|
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.2 + move2 * 0.2);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2 + move2 * 0.8)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -160,8 +159,8 @@ impl Animation for AlphaAnimation {
|
|||||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.6 + move2 * 0.9);
|
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.6 + move2 * 0.9);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2 + move2 * 0.8)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -192,11 +191,11 @@ impl Animation for AlphaAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(-0.15)
|
* Quaternion::rotation_y(-0.15)
|
||||||
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
|
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(0.15)
|
* Quaternion::rotation_y(0.15)
|
||||||
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
||||||
@ -222,15 +221,15 @@ impl Animation for AlphaAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move2 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move2 * 1.5)
|
||||||
* Quaternion::rotation_y(move2 * 0.5)
|
* Quaternion::rotation_y(move2 * 0.5)
|
||||||
* Quaternion::rotation_z(
|
* Quaternion::rotation_z(
|
||||||
-0.35 + move1 * -0.5 + move2 * 1.0,
|
-0.35 + move1 * -0.5 + move2 * 1.0,
|
||||||
);
|
);
|
||||||
next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
|
next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35);
|
* Quaternion::rotation_z(0.35);
|
||||||
|
|
||||||
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
|
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
} else {
|
} else {
|
||||||
@ -253,12 +252,12 @@ impl Animation for AlphaAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move2 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move2 * 1.5)
|
||||||
* Quaternion::rotation_y(move2 * -0.5)
|
* Quaternion::rotation_y(move2 * -0.5)
|
||||||
* Quaternion::rotation_z(0.35 + move1 * 0.5 + move2 * -1.0);
|
* Quaternion::rotation_z(0.35 + move1 * 0.5 + move2 * -1.0);
|
||||||
next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
|
next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
* Quaternion::rotation_z(-0.35);
|
* Quaternion::rotation_z(-0.35);
|
||||||
|
|
||||||
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
|
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
@ -286,8 +285,10 @@ impl Animation for AlphaAnimation {
|
|||||||
* Quaternion::rotation_y(move1 * 0.3 + move2 * -0.6)
|
* Quaternion::rotation_y(move1 * 0.3 + move2 * -0.6)
|
||||||
* Quaternion::rotation_z(move1 * -0.8 + move2 * 1.8);
|
* Quaternion::rotation_z(move1 * -0.8 + move2 * 1.8);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(1.57 + move2 * 1.0);
|
next.control_l.orientation =
|
||||||
next.control_r.orientation = Quaternion::rotation_x(1.57 + move2 * 1.0);
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 1.0);
|
||||||
|
next.control_r.orientation =
|
||||||
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 1.0);
|
||||||
|
|
||||||
next.shoulder_l.orientation = Quaternion::rotation_x(-0.3)
|
next.shoulder_l.orientation = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(move1 * 0.7 + move2 * -0.7);
|
* Quaternion::rotation_y(move1 * 0.7 + move2 * -0.7);
|
||||||
@ -315,10 +316,10 @@ impl Animation for AlphaAnimation {
|
|||||||
Quaternion::rotation_z(move1 * -0.2 + move2 * 0.2);
|
Quaternion::rotation_z(move1 * -0.2 + move2 * 0.2);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8)
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 0.8)
|
||||||
* Quaternion::rotation_y(-0.0);
|
* Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)
|
Quaternion::rotation_x(FRAC_PI_2 + 0.2 + move2 * 0.8)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -373,10 +374,10 @@ impl Animation for AlphaAnimation {
|
|||||||
-s_a.grip.0 / 0.8,
|
-s_a.grip.0 / 0.8,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
* Quaternion::rotation_y(-0.0)
|
* Quaternion::rotation_y(-0.0)
|
||||||
* Quaternion::rotation_z(PI);
|
* Quaternion::rotation_z(PI);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2)
|
||||||
* Quaternion::rotation_y(-1.0 + move1 * 1.0)
|
* Quaternion::rotation_y(-1.0 + move1 * 1.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{AbilitySpec, ToolKind},
|
comp::item::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct BeamAnimation;
|
pub struct BeamAnimation;
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ impl Animation for BeamAnimation {
|
|||||||
next.jaw.orientation = Quaternion::rotation_x(0.0);
|
next.jaw.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.5);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.5);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.4)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.4)
|
||||||
* Quaternion::rotation_y(0.5)
|
* Quaternion::rotation_y(0.5)
|
||||||
* Quaternion::rotation_z(move1 * 1.2 + move2shake * 0.5);
|
* Quaternion::rotation_z(move1 * 1.2 + move2shake * 0.5);
|
||||||
@ -138,13 +138,13 @@ impl Animation for BeamAnimation {
|
|||||||
next.hand_l.position = Vec3::new(-14.0 + move1 * 3.0, 2.0, -4.0);
|
next.hand_l.position = Vec3::new(-14.0 + move1 * 3.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move2shake * -0.07)
|
Quaternion::rotation_x(FRAC_PI_3 + move2shake * -0.07)
|
||||||
* Quaternion::rotation_y(move1 * -0.5)
|
* Quaternion::rotation_y(move1 * -0.5)
|
||||||
* Quaternion::rotation_z(-0.35 + move2shake * 0.07);
|
* Quaternion::rotation_z(-0.35 + move2shake * 0.07);
|
||||||
next.hand_r.position = Vec3::new(14.0 + move1 - 3.0, 2.0, -4.0);
|
next.hand_r.position = Vec3::new(14.0 + move1 - 3.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move2shake * 0.07)
|
Quaternion::rotation_x(FRAC_PI_3 + move2shake * 0.07)
|
||||||
* Quaternion::rotation_y(move1 * -0.5)
|
* Quaternion::rotation_y(move1 * -0.5)
|
||||||
* Quaternion::rotation_z(0.35 - move2shake * 0.07);
|
* Quaternion::rotation_z(0.35 - move2shake * 0.07);
|
||||||
|
|
||||||
@ -158,13 +158,13 @@ impl Animation for BeamAnimation {
|
|||||||
next.hand_l.position = Vec3::new(-14.0 + move1 * 3.0, 2.0, -4.0);
|
next.hand_l.position = Vec3::new(-14.0 + move1 * 3.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move2shake * 0.07)
|
Quaternion::rotation_x(FRAC_PI_3 + move2shake * 0.07)
|
||||||
* Quaternion::rotation_y(move1 * 0.5)
|
* Quaternion::rotation_y(move1 * 0.5)
|
||||||
* Quaternion::rotation_z(-0.35 + move2shake * 0.07);
|
* Quaternion::rotation_z(-0.35 + move2shake * 0.07);
|
||||||
next.hand_r.position = Vec3::new(14.0 + move1 - 3.0, 2.0, -4.0);
|
next.hand_r.position = Vec3::new(14.0 + move1 - 3.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move2shake * -0.07)
|
Quaternion::rotation_x(FRAC_PI_3 + move2shake * -0.07)
|
||||||
* Quaternion::rotation_y(move1 * 0.5)
|
* Quaternion::rotation_y(move1 * 0.5)
|
||||||
* Quaternion::rotation_z(0.35 - move2shake * -0.07);
|
* Quaternion::rotation_z(0.35 - move2shake * -0.07);
|
||||||
|
|
||||||
@ -182,14 +182,14 @@ impl Animation for BeamAnimation {
|
|||||||
Quaternion::rotation_x(move2 * -0.5 + move2shake * -0.1);
|
Quaternion::rotation_x(move2 * -0.5 + move2shake * -0.1);
|
||||||
next.control_l.position = Vec3::new(-0.5, 4.0, 1.0);
|
next.control_l.position = Vec3::new(-0.5, 4.0, 1.0);
|
||||||
next.control_r.position = Vec3::new(-0.5, 4.0, 1.0);
|
next.control_r.position = Vec3::new(-0.5, 4.0, 1.0);
|
||||||
next.control_l.orientation = Quaternion::rotation_x(1.57);
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(1.57);
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
|
|
||||||
next.weapon_l.position = Vec3::new(-12.0, -1.0, -15.0);
|
next.weapon_l.position = Vec3::new(-12.0, -1.0, -15.0);
|
||||||
next.weapon_r.position = Vec3::new(12.0, -1.0, -15.0);
|
next.weapon_r.position = Vec3::new(12.0, -1.0, -15.0);
|
||||||
|
|
||||||
next.weapon_l.orientation = Quaternion::rotation_x(-1.57 - 0.1);
|
next.weapon_l.orientation = Quaternion::rotation_x(-FRAC_PI_2 - 0.1);
|
||||||
next.weapon_r.orientation = Quaternion::rotation_x(-1.57 - 0.1);
|
next.weapon_r.orientation = Quaternion::rotation_x(-FRAC_PI_2 - 0.1);
|
||||||
|
|
||||||
next.arm_control_r.orientation =
|
next.arm_control_r.orientation =
|
||||||
Quaternion::rotation_x(move1 * 1.1 + move2 * -1.6)
|
Quaternion::rotation_x(move1 * 1.1 + move2 * -1.6)
|
||||||
@ -245,8 +245,8 @@ impl Animation for BeamAnimation {
|
|||||||
Vec3::new(-6.0, 0.0 + s_a.grip.0 / 1.0, -s_a.grip.0 / 0.8);
|
Vec3::new(-6.0, 0.0 + s_a.grip.0 / 1.0, -s_a.grip.0 / 0.8);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_z(PI);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2)
|
||||||
* Quaternion::rotation_y(-1.0);
|
* Quaternion::rotation_y(-1.0);
|
||||||
|
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::tool::{AbilitySpec, ToolKind},
|
comp::item::tool::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct BetaAnimation;
|
pub struct BetaAnimation;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ impl Animation for BetaAnimation {
|
|||||||
next.lower_torso.orientation =
|
next.lower_torso.orientation =
|
||||||
Quaternion::rotation_z(move1base * -0.5 + move2 * 0.7);
|
Quaternion::rotation_z(move1base * -0.5 + move2 * 0.7);
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move1 * -0.5 + move2 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_2 + move1 * -0.5 + move2 * 1.5)
|
||||||
* Quaternion::rotation_y(-0.2);
|
* Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
|
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
|
||||||
@ -131,8 +131,8 @@ impl Animation for BetaAnimation {
|
|||||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.6 + move2 * 1.5);
|
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.6 + move2 * 1.5);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2 + move2 * 0.8)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -156,8 +156,8 @@ impl Animation for BetaAnimation {
|
|||||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -1.2 + move2 * 1.0);
|
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -1.2 + move2 * 1.0);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(FRAC_PI_2 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2 + move2 * 0.8)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -188,11 +188,11 @@ impl Animation for BetaAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(-0.15)
|
* Quaternion::rotation_y(-0.15)
|
||||||
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
|
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(0.15)
|
* Quaternion::rotation_y(0.15)
|
||||||
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
||||||
@ -223,11 +223,11 @@ impl Animation for BetaAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(-0.15)
|
* Quaternion::rotation_y(-0.15)
|
||||||
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
|
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(0.15)
|
* Quaternion::rotation_y(0.15)
|
||||||
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct BlinkAnimation;
|
pub struct BlinkAnimation;
|
||||||
|
|
||||||
@ -22,7 +22,6 @@ impl Animation for BlinkAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_blink\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_blink\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_blink")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_blink")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency<'a>,
|
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency<'a>,
|
||||||
@ -92,7 +91,7 @@ impl Animation for BlinkAnimation {
|
|||||||
-11.0 + -s_a.grip.0 / 2.0,
|
-11.0 + -s_a.grip.0 / 2.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * -0.8)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 - move1 * -0.8)
|
||||||
* Quaternion::rotation_y(-0.5 + move1 * -0.0)
|
* Quaternion::rotation_y(-0.5 + move1 * -0.0)
|
||||||
* Quaternion::rotation_z(move1 * 0.0);
|
* Quaternion::rotation_z(move1 * 0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.7)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.7)
|
||||||
|
@ -3,6 +3,7 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct ChargeAnimation;
|
pub struct ChargeAnimation;
|
||||||
|
|
||||||
@ -34,7 +35,8 @@ impl Animation for ChargeAnimation {
|
|||||||
|
|
||||||
let foot = ((5.0 / (0.2 + 4.8 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
|
let foot = ((5.0 / (0.2 + 4.8 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 8.0).sin());
|
* ((anim_time * lab * 8.0).sin());
|
||||||
let foote = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 8.0 + 1.57).sin()).powi(2))).sqrt())
|
let foote = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 8.0 + FRAC_PI_2).sin()).powi(2)))
|
||||||
|
.sqrt())
|
||||||
* ((anim_time * lab * 8.0).sin());
|
* ((anim_time * lab * 8.0).sin());
|
||||||
let stress = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 20.0).cos()).powi(2))).sqrt())
|
let stress = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 20.0).cos()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 20.0).cos());
|
* ((anim_time * lab * 20.0).cos());
|
||||||
@ -99,7 +101,7 @@ impl Animation for ChargeAnimation {
|
|||||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||||
|
|
||||||
next.hold.position = Vec3::new(0.0, -1.0, -15.2);
|
next.hold.position = Vec3::new(0.0, -1.0, -15.2);
|
||||||
next.hold.orientation = Quaternion::rotation_x(-1.57);
|
next.hold.orientation = Quaternion::rotation_x(-FRAC_PI_2);
|
||||||
next.hold.scale = Vec3::one() * 1.0;
|
next.hold.scale = Vec3::one() * 1.0;
|
||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
|
@ -26,7 +26,6 @@ impl Animation for ChargeMeleeAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_chargemelee\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_chargemelee\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_chargemelee")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_chargemelee")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::tool::{AbilitySpec, ToolKind},
|
comp::item::tool::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct DashAnimation;
|
pub struct DashAnimation;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ impl Animation for DashAnimation {
|
|||||||
next.lower_torso.orientation = Quaternion::rotation_x(move2 * 0.2 + move3 * -0.2)
|
next.lower_torso.orientation = Quaternion::rotation_x(move2 * 0.2 + move3 * -0.2)
|
||||||
* Quaternion::rotation_z(move1 * -0.8 + move3 * 0.7);
|
* Quaternion::rotation_z(move1 * -0.8 + move3 * 0.7);
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + move1 * -0.5 + move2 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_2 + move1 * -0.5 + move2 * 1.5)
|
||||||
* Quaternion::rotation_y(-0.2);
|
* Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
|
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
|
||||||
@ -143,9 +143,9 @@ impl Animation for DashAnimation {
|
|||||||
* Quaternion::rotation_x(move1 * 0.4 + move3 * -0.7 + footrotr * 0.1)
|
* Quaternion::rotation_x(move1 * 0.4 + move3 * -0.7 + footrotr * 0.1)
|
||||||
* Quaternion::rotation_z(move1 * -0.6 + move3 * 1.6);
|
* Quaternion::rotation_z(move1 * -0.6 + move3 * 1.6);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move3 * 0.3)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 + move3 * 0.3)
|
||||||
* Quaternion::rotation_y(move1 * 0.7);
|
* Quaternion::rotation_y(move1 * 0.7);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move3 * -0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2 + move3 * -0.2)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -187,8 +187,8 @@ impl Animation for DashAnimation {
|
|||||||
* Quaternion::rotation_y(move1 * 0.6 + move2 * -0.6)
|
* Quaternion::rotation_y(move1 * 0.6 + move2 * -0.6)
|
||||||
* Quaternion::rotation_z(move3 * -0.5);
|
* Quaternion::rotation_z(move3 * -0.5);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(1.57);
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(1.57);
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
|
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||||
@ -200,7 +200,7 @@ impl Animation for DashAnimation {
|
|||||||
next.head.orientation =
|
next.head.orientation =
|
||||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(move1 * -0.3);
|
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(move1 * -0.3);
|
||||||
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.1)
|
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.1)
|
||||||
* Quaternion::rotation_z(move1 * 1.57);
|
* Quaternion::rotation_z(move1 * FRAC_PI_2);
|
||||||
next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.1)
|
next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.1)
|
||||||
* Quaternion::rotation_x(move1 * -0.1)
|
* Quaternion::rotation_x(move1 * -0.1)
|
||||||
* Quaternion::rotation_z(move1 * -0.2);
|
* Quaternion::rotation_z(move1 * -0.2);
|
||||||
@ -208,13 +208,13 @@ impl Animation for DashAnimation {
|
|||||||
next.hand_l.position = Vec3::new(-14.0, 2.0 + motion * 1.5, -4.0);
|
next.hand_l.position = Vec3::new(-14.0, 2.0 + motion * 1.5, -4.0);
|
||||||
|
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 1.0)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 1.0)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(-0.35 + motion * -0.6);
|
* Quaternion::rotation_z(-0.35 + motion * -0.6);
|
||||||
next.hand_r.position = Vec3::new(14.0, 2.0 + motion * -1.5, -4.0);
|
next.hand_r.position = Vec3::new(14.0, 2.0 + motion * -1.5, -4.0);
|
||||||
|
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 1.0)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 1.0)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.35 + motion * 0.6);
|
* Quaternion::rotation_z(0.35 + motion * 0.6);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_4, PI};
|
||||||
|
|
||||||
pub struct EquipAnimation;
|
pub struct EquipAnimation;
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ impl Animation for EquipAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_equip\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_equip\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_equip")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_equip")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency<'a>,
|
(active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency<'a>,
|
||||||
@ -27,9 +26,9 @@ impl Animation for EquipAnimation {
|
|||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
|
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
|
||||||
let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos();
|
let equip_slowa = 1.0 + (anim_time * 12.0 + FRAC_PI_4).cos();
|
||||||
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(-1.57);
|
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(-FRAC_PI_2);
|
||||||
next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
|
next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5);
|
next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5);
|
||||||
|
|
||||||
match active_tool_kind {
|
match active_tool_kind {
|
||||||
@ -49,9 +48,9 @@ impl Animation for EquipAnimation {
|
|||||||
next.hand_l.position = Vec3::new(4.0, -6.0, 0.0);
|
next.hand_l.position = Vec3::new(4.0, -6.0, 0.0);
|
||||||
next.hand_r.position = Vec3::new(6.0, -6.0, 6.0);
|
next.hand_r.position = Vec3::new(6.0, -6.0, 6.0);
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_y(2.2) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.2) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_y(2.2) * Quaternion::rotation_z(-1.57);
|
Quaternion::rotation_y(2.2) * Quaternion::rotation_z(-FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Bow) => {
|
Some(ToolKind::Bow) => {
|
||||||
next.hand_l.position = Vec3::new(-9.0, -5.0, -8.0);
|
next.hand_l.position = Vec3::new(-9.0, -5.0, -8.0);
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -91,26 +94,31 @@ impl Animation for IdleAnimation {
|
|||||||
match active_tool_kind {
|
match active_tool_kind {
|
||||||
Some(ToolKind::Bow) => {
|
Some(ToolKind::Bow) => {
|
||||||
next.main.position = Vec3::new(0.0, -6.0, 0.0);
|
next.main.position = Vec3::new(0.0, -6.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||||
next.main.position = Vec3::new(-6.0, -5.0, -12.0);
|
next.main.position = Vec3::new(-6.0, -5.0, -12.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(0.6) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Sword) => {
|
Some(ToolKind::Sword) => {
|
||||||
next.main.position = Vec3::new(-10.0, -8.0, 12.0);
|
next.main.position = Vec3::new(-10.0, -8.0, 12.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Hammer) | Some(ToolKind::Axe) => {
|
Some(ToolKind::Hammer) | Some(ToolKind::Axe) => {
|
||||||
next.main.position = Vec3::new(-6.0, -8.0, 8.0);
|
next.main.position = Vec3::new(-6.0, -8.0, 8.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
next.second.position = Vec3::new(6.0, -8.0, 8.0);
|
next.second.position = Vec3::new(6.0, -8.0, 8.0);
|
||||||
next.second.orientation =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
next.main.position = Vec3::new(-2.0, -5.0, -6.0);
|
next.main.position = Vec3::new(-2.0, -5.0, -6.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(0.6) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
@ -64,23 +64,28 @@ impl Animation for JumpAnimation {
|
|||||||
match active_tool_kind {
|
match active_tool_kind {
|
||||||
Some(ToolKind::Bow) => {
|
Some(ToolKind::Bow) => {
|
||||||
next.main.position = Vec3::new(-2.0, -5.0, -6.0);
|
next.main.position = Vec3::new(-2.0, -5.0, -6.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||||
next.main.position = Vec3::new(-6.0, -5.0, -12.0);
|
next.main.position = Vec3::new(-6.0, -5.0, -12.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(0.6) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Sword) => {
|
Some(ToolKind::Sword) => {
|
||||||
next.main.position = Vec3::new(-10.0, -8.0, 12.0);
|
next.main.position = Vec3::new(-10.0, -8.0, 12.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Hammer) | Some(ToolKind::Axe) => {
|
Some(ToolKind::Hammer) | Some(ToolKind::Axe) => {
|
||||||
next.main.position = Vec3::new(-10.0, -8.0, 12.0);
|
next.main.position = Vec3::new(-10.0, -8.0, 12.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
next.main.position = Vec3::new(-2.0, -5.0, -6.0);
|
next.main.position = Vec3::new(-2.0, -5.0, -6.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(0.6) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ impl Animation for LeapAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_leapmelee\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_leapmelee\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_leapmelee")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_leapmelee")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency<'a>,
|
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency<'a>,
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_4, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -83,10 +86,10 @@ impl Animation for RunAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 21.0 };
|
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 21.0 };
|
||||||
let shift1 = speedadjust - PI / 2.0 - speedadjust * PI * 3.0 / 4.0;
|
let shift1 = speedadjust - FRAC_PI_2 - speedadjust * PI * 3.0 / 4.0;
|
||||||
let shift2 = speedadjust + PI / 2.0 + speedadjust * PI / 2.0;
|
let shift2 = speedadjust + FRAC_PI_2 + speedadjust * FRAC_PI_2;
|
||||||
let shift3 = speedadjust + PI / 4.0 - speedadjust * PI / 4.0;
|
let shift3 = speedadjust + FRAC_PI_4 - speedadjust * FRAC_PI_4;
|
||||||
let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * PI / 2.0;
|
let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * FRAC_PI_2;
|
||||||
|
|
||||||
//FL
|
//FL
|
||||||
let foot1a = (acc_vel * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin();
|
let foot1a = (acc_vel * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin();
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::tool::{AbilitySpec, ToolKind},
|
comp::item::tool::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct ShootAnimation;
|
pub struct ShootAnimation;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ impl Animation for ShootAnimation {
|
|||||||
* Quaternion::rotation_z(move1 * 0.25);
|
* Quaternion::rotation_z(move1 * 0.25);
|
||||||
next.jaw.orientation = Quaternion::rotation_x(move1 * -0.5);
|
next.jaw.orientation = Quaternion::rotation_x(move1 * -0.5);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move1 * 0.5)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(move1 * -0.4);
|
* Quaternion::rotation_y(move1 * -0.4);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.5)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(0.5)
|
* Quaternion::rotation_y(0.5)
|
||||||
@ -160,7 +160,7 @@ impl Animation for ShootAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(move1 * 0.2 + PI / 2.0 + move2 * 0.4)
|
Quaternion::rotation_x(move1 * 0.2 + FRAC_PI_2 + move2 * 0.4)
|
||||||
* Quaternion::rotation_y(-0.2);
|
* Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.2 + move1 * 0.4)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.2 + move1 * 0.4)
|
||||||
* Quaternion::rotation_y(0.4)
|
* Quaternion::rotation_y(0.4)
|
||||||
@ -211,11 +211,11 @@ impl Animation for ShootAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(-0.15)
|
* Quaternion::rotation_y(-0.15)
|
||||||
* Quaternion::rotation_z(move1 * 0.5);
|
* Quaternion::rotation_z(move1 * 0.5);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 0.5)
|
||||||
* Quaternion::rotation_y(0.15)
|
* Quaternion::rotation_y(0.15)
|
||||||
* Quaternion::rotation_z(move1 * -0.5);
|
* Quaternion::rotation_z(move1 * -0.5);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.3);
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.3);
|
||||||
@ -256,10 +256,10 @@ impl Animation for ShootAnimation {
|
|||||||
* Quaternion::rotation_z(twist);
|
* Quaternion::rotation_z(twist);
|
||||||
|
|
||||||
next.arm_control_r.orientation =
|
next.arm_control_r.orientation =
|
||||||
Quaternion::rotation_x(move1 * PI / 2.0)
|
Quaternion::rotation_x(move1 * FRAC_PI_2)
|
||||||
* Quaternion::rotation_y(move1 * -PI / 2.0 + move2 * 2.5);
|
* Quaternion::rotation_y(move1 * -FRAC_PI_2 + move2 * 2.5);
|
||||||
//* Quaternion::rotation_y(move1 * -PI/2.0)
|
//* Quaternion::rotation_y(move1 * -FRAC_PI_2)
|
||||||
//* Quaternion::rotation_z(move1 * -PI/2.0);
|
//* Quaternion::rotation_z(move1 * -FRAC_PI_2);
|
||||||
next.arm_control_r.position =
|
next.arm_control_r.position =
|
||||||
Vec3::new(0.0, move1 * 10.0 + move2 * -10.0, 0.0);
|
Vec3::new(0.0, move1 * 10.0 + move2 * -10.0, 0.0);
|
||||||
},
|
},
|
||||||
@ -277,8 +277,8 @@ impl Animation for ShootAnimation {
|
|||||||
Vec3::new(-7.0, 0.0 + s_a.grip.0 / 1.0, -s_a.grip.0 / 0.8);
|
Vec3::new(-7.0, 0.0 + s_a.grip.0 / 1.0, -s_a.grip.0 / 0.8);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_z(PI);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2)
|
||||||
* Quaternion::rotation_y(-1.0)
|
* Quaternion::rotation_y(-1.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -317,9 +317,10 @@ impl Animation for ShootAnimation {
|
|||||||
s_a.shoulder.1,
|
s_a.shoulder.1,
|
||||||
s_a.shoulder.2,
|
s_a.shoulder.2,
|
||||||
);
|
);
|
||||||
next.shoulder_r.orientation = Quaternion::rotation_y(move1 * -PI / 2.0)
|
next.shoulder_r.orientation =
|
||||||
* Quaternion::rotation_x(move2 * 2.0)
|
Quaternion::rotation_y(move1 * -FRAC_PI_2)
|
||||||
* Quaternion::rotation_z(move1 * -PI / 2.0);
|
* Quaternion::rotation_x(move2 * 2.0)
|
||||||
|
* Quaternion::rotation_z(move1 * -FRAC_PI_2);
|
||||||
|
|
||||||
next.hand_r.position = Vec3::new(
|
next.hand_r.position = Vec3::new(
|
||||||
-s_a.grip.1 + move1 * -2.0 + move2 * 8.0,
|
-s_a.grip.1 + move1 * -2.0 + move2 * 8.0,
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, TAU};
|
||||||
|
|
||||||
pub struct SpinAnimation;
|
pub struct SpinAnimation;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ impl Animation for SpinAnimation {
|
|||||||
let foot = ((5.0 / (1.1 + 3.9 * ((anim_time * lab * 10.32).sin()).powi(2))).sqrt())
|
let foot = ((5.0 / (1.1 + 3.9 * ((anim_time * lab * 10.32).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 10.32).sin());
|
* ((anim_time * lab * 10.32).sin());
|
||||||
|
|
||||||
let decel = (anim_time * 16.0 * lab).min(PI / 2.0).sin();
|
let decel = (anim_time * 16.0 * lab).min(FRAC_PI_2).sin();
|
||||||
|
|
||||||
let spin = (anim_time * 2.8 * lab).sin();
|
let spin = (anim_time * 2.8 * lab).sin();
|
||||||
let spinhalf = (anim_time * 1.4 * lab).sin();
|
let spinhalf = (anim_time * 1.4 * lab).sin();
|
||||||
@ -67,7 +67,7 @@ impl Animation for SpinAnimation {
|
|||||||
);
|
);
|
||||||
next.control.orientation = Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
|
next.control.orientation = Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
|
||||||
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)
|
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)
|
||||||
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57);
|
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * FRAC_PI_2);
|
||||||
next.head.position = Vec3::new(
|
next.head.position = Vec3::new(
|
||||||
0.0 + 2.0 + movement2 * -2.0,
|
0.0 + 2.0 + movement2 * -2.0,
|
||||||
2.0 + movement2 * -2.0 + s_a.head.0,
|
2.0 + movement2 * -2.0 + s_a.head.0,
|
||||||
@ -87,7 +87,7 @@ impl Animation for SpinAnimation {
|
|||||||
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
|
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
|
||||||
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
|
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
|
||||||
|
|
||||||
next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28);
|
next.torso.orientation = Quaternion::rotation_z(movement2 * TAU);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Dagger) = active_tool_kind {
|
if let Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Dagger) = active_tool_kind {
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct SpinMeleeAnimation;
|
pub struct SpinMeleeAnimation;
|
||||||
|
|
||||||
@ -22,7 +22,6 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_spinmelee\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_spinmelee\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_spinmelee")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_spinmelee")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency<'a>,
|
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency<'a>,
|
||||||
@ -101,7 +100,7 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
-11.0 + -s_a.grip.0 / 2.0 + move1 * 8.0,
|
-11.0 + -s_a.grip.0 / 2.0 + move1 * 8.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * 0.2)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 - move1 * 0.2)
|
||||||
* Quaternion::rotation_y(-0.5 + move1 * 0.3)
|
* Quaternion::rotation_y(-0.5 + move1 * 0.3)
|
||||||
* Quaternion::rotation_z(move1 * 0.0);
|
* Quaternion::rotation_z(move1 * 0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.0)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.0)
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{AbilitySpec, ToolKind},
|
comp::item::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct SpriteSummonAnimation;
|
pub struct SpriteSummonAnimation;
|
||||||
|
|
||||||
@ -104,8 +104,8 @@ impl Animation for SpriteSummonAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_z(PI);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2)
|
||||||
* Quaternion::rotation_y(-1.0)
|
* Quaternion::rotation_y(-1.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::tool::{AbilitySpec, ToolKind},
|
comp::item::tool::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct StunnedAnimation;
|
pub struct StunnedAnimation;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ impl Animation for StunnedAnimation {
|
|||||||
|
|
||||||
let short = (acc_vel * lab).sin() * speednorm;
|
let short = (acc_vel * lab).sin() * speednorm;
|
||||||
|
|
||||||
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
|
let shortalt = (anim_time * lab * 16.0 + FRAC_PI_2).sin();
|
||||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.second.orientation = Quaternion::rotation_x(0.0);
|
next.second.orientation = Quaternion::rotation_x(0.0);
|
||||||
if s_a.beast {
|
if s_a.beast {
|
||||||
@ -138,7 +138,7 @@ impl Animation for StunnedAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.2);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
|
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ impl Animation for StunnedAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.2);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
|
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
|
||||||
|
|
||||||
@ -175,8 +175,8 @@ impl Animation for StunnedAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2);
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2);
|
||||||
|
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(-1.0 + short * 0.2) * Quaternion::rotation_y(-1.8);
|
Quaternion::rotation_x(-1.0 + short * 0.2) * Quaternion::rotation_y(-1.8);
|
||||||
@ -192,7 +192,7 @@ impl Animation for StunnedAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.5);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.5);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5)
|
||||||
* Quaternion::rotation_y(0.5)
|
* Quaternion::rotation_y(0.5)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
@ -207,10 +207,10 @@ impl Animation for StunnedAnimation {
|
|||||||
next.control_l.position = Vec3::new(-9.0, 19.0, -13.0);
|
next.control_l.position = Vec3::new(-9.0, 19.0, -13.0);
|
||||||
next.control_r.position = Vec3::new(9.0, 19.0, -13.0);
|
next.control_r.position = Vec3::new(9.0, 19.0, -13.0);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 3.0)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
* Quaternion::rotation_y(-0.15);
|
* Quaternion::rotation_y(-0.15);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15);
|
* Quaternion::rotation_y(0.15);
|
||||||
},
|
},
|
||||||
"Tidal Warrior" => {
|
"Tidal Warrior" => {
|
||||||
next.head.orientation = Quaternion::rotation_x(movement1 * -2.0);
|
next.head.orientation = Quaternion::rotation_x(movement1 * -2.0);
|
||||||
@ -221,10 +221,10 @@ impl Animation for StunnedAnimation {
|
|||||||
next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
|
next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
|
||||||
next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
|
next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
* Quaternion::rotation_z(-0.35);
|
* Quaternion::rotation_z(-0.35);
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35);
|
* Quaternion::rotation_z(0.35);
|
||||||
},
|
},
|
||||||
"Beast Claws" => {
|
"Beast Claws" => {
|
||||||
next.shoulder_l.position =
|
next.shoulder_l.position =
|
||||||
@ -403,11 +403,13 @@ impl Animation for StunnedAnimation {
|
|||||||
next.weapon_l.position = Vec3::new(-12.0, -6.0, -18.0);
|
next.weapon_l.position = Vec3::new(-12.0, -6.0, -18.0);
|
||||||
next.weapon_r.position = Vec3::new(12.0, -6.0, -18.0);
|
next.weapon_r.position = Vec3::new(12.0, -6.0, -18.0);
|
||||||
|
|
||||||
next.weapon_l.orientation = Quaternion::rotation_x(-1.57 - 0.1);
|
next.weapon_l.orientation =
|
||||||
next.weapon_r.orientation = Quaternion::rotation_x(-1.57 - 0.1);
|
Quaternion::rotation_x(-FRAC_PI_2 - 0.1);
|
||||||
|
next.weapon_r.orientation =
|
||||||
|
Quaternion::rotation_x(-FRAC_PI_2 - 0.1);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(1.57);
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(1.57);
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
|
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{AbilitySpec, ToolKind},
|
comp::item::{AbilitySpec, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI};
|
||||||
|
|
||||||
pub struct SummonAnimation;
|
pub struct SummonAnimation;
|
||||||
|
|
||||||
@ -26,7 +26,6 @@ impl Animation for SummonAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"biped_large_summon\0";
|
const UPDATE_FN: &'static [u8] = b"biped_large_summon\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_summon")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_summon")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
@ -111,7 +110,7 @@ impl Animation for SummonAnimation {
|
|||||||
-11.0 + -s_a.grip.0 / 2.0 + move1 * 15.0 + move2 * -12.0,
|
-11.0 + -s_a.grip.0 / 2.0 + move1 * 15.0 + move2 * -12.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * 0.2)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 - move1 * 0.2)
|
||||||
* Quaternion::rotation_y(-0.5 + move2 * -0.4)
|
* Quaternion::rotation_y(-0.5 + move2 * -0.4)
|
||||||
* Quaternion::rotation_z(move1 * 0.0);
|
* Quaternion::rotation_z(move1 * 0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.2)
|
||||||
@ -165,11 +164,11 @@ impl Animation for SummonAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 1.5)
|
||||||
* Quaternion::rotation_y(-move1 * 0.7 + move2 * 0.2)
|
* Quaternion::rotation_y(-move1 * 0.7 + move2 * 0.2)
|
||||||
* Quaternion::rotation_z(-0.35);
|
* Quaternion::rotation_z(-0.35);
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 3.0 + move1 * 1.5)
|
Quaternion::rotation_x(FRAC_PI_3 + move1 * 1.5)
|
||||||
* Quaternion::rotation_y(move1 * 0.7 + move2 * 0.2)
|
* Quaternion::rotation_y(move1 * 0.7 + move2 * 0.2)
|
||||||
* Quaternion::rotation_z(0.35);
|
* Quaternion::rotation_z(0.35);
|
||||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::tool::{AbilitySpec, ToolKind};
|
use common::comp::item::tool::{AbilitySpec, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_3, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct WieldAnimation;
|
pub struct WieldAnimation;
|
||||||
|
|
||||||
@ -90,7 +93,7 @@ impl Animation for WieldAnimation {
|
|||||||
|
|
||||||
let short = (acc_vel * lab).sin() * speednorm;
|
let short = (acc_vel * lab).sin() * speednorm;
|
||||||
|
|
||||||
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
|
let shortalt = (anim_time * lab * 16.0 + FRAC_PI_2).sin();
|
||||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.second.orientation = Quaternion::rotation_x(0.0);
|
next.second.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
@ -174,7 +177,7 @@ impl Animation for WieldAnimation {
|
|||||||
next.second.scale = Vec3::one() * 0.0;
|
next.second.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.2);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
|
Quaternion::rotation_x(PI / 2.2) * Quaternion::rotation_y(0.2);
|
||||||
|
|
||||||
@ -192,7 +195,7 @@ impl Animation for WieldAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.2);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.2);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.2)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.2)
|
||||||
* Quaternion::rotation_y(0.2)
|
* Quaternion::rotation_y(0.2)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
@ -212,8 +215,8 @@ impl Animation for WieldAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + 0.2)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
@ -231,7 +234,7 @@ impl Animation for WieldAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.5);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.5);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5)
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5)
|
||||||
* Quaternion::rotation_y(0.5)
|
* Quaternion::rotation_y(0.5)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
@ -246,19 +249,19 @@ impl Animation for WieldAnimation {
|
|||||||
next.control_l.position = Vec3::new(-9.0, 19.0, -13.0);
|
next.control_l.position = Vec3::new(-9.0, 19.0, -13.0);
|
||||||
next.control_r.position = Vec3::new(9.0, 19.0, -13.0);
|
next.control_r.position = Vec3::new(9.0, 19.0, -13.0);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 3.0)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
* Quaternion::rotation_y(-0.15);
|
* Quaternion::rotation_y(-0.15);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15);
|
* Quaternion::rotation_y(0.15);
|
||||||
},
|
},
|
||||||
"Tidal Warrior" => {
|
"Tidal Warrior" => {
|
||||||
next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
|
next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
|
||||||
next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
|
next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
* Quaternion::rotation_z(-0.35);
|
* Quaternion::rotation_z(-0.35);
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_3)
|
||||||
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35);
|
* Quaternion::rotation_z(0.35);
|
||||||
},
|
},
|
||||||
"Beast Claws" => {
|
"Beast Claws" => {
|
||||||
next.shoulder_l.position =
|
next.shoulder_l.position =
|
||||||
@ -438,10 +441,12 @@ impl Animation for WieldAnimation {
|
|||||||
next.weapon_l.position = Vec3::new(-12.0, -6.0, -18.0);
|
next.weapon_l.position = Vec3::new(-12.0, -6.0, -18.0);
|
||||||
next.weapon_r.position = Vec3::new(12.0, -6.0, -18.0);
|
next.weapon_r.position = Vec3::new(12.0, -6.0, -18.0);
|
||||||
|
|
||||||
next.weapon_l.orientation = Quaternion::rotation_x(-1.57 - 0.1);
|
next.weapon_l.orientation =
|
||||||
next.weapon_r.orientation = Quaternion::rotation_x(-1.57 - 0.1);
|
Quaternion::rotation_x(-FRAC_PI_2 - 0.1);
|
||||||
|
next.weapon_r.orientation =
|
||||||
|
Quaternion::rotation_x(-FRAC_PI_2 - 0.1);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(1.57);
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(1.57);
|
next.control_r.orientation = Quaternion::rotation_x(1.57);
|
||||||
|
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
@ -481,10 +486,11 @@ impl Animation for WieldAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_z(PI);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
|
next.control_r.orientation =
|
||||||
* Quaternion::rotation_y(-1.0)
|
Quaternion::rotation_x(FRAC_PI_2 + 0.2)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_y(-1.0)
|
||||||
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(-1.4) * Quaternion::rotation_y(-2.8);
|
Quaternion::rotation_x(-1.4) * Quaternion::rotation_y(-2.8);
|
||||||
@ -504,13 +510,13 @@ impl Animation for WieldAnimation {
|
|||||||
Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(1.4 + slow * 0.1)
|
Quaternion::rotation_x(1.4 + slow * 0.1)
|
||||||
* Quaternion::rotation_z(-PI / 2.0);
|
* Quaternion::rotation_z(-FRAC_PI_2);
|
||||||
|
|
||||||
next.hand_r.position =
|
next.hand_r.position =
|
||||||
Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(1.4 - slow * 0.1)
|
Quaternion::rotation_x(1.4 - slow * 0.1)
|
||||||
* Quaternion::rotation_z(PI / 2.0);
|
* Quaternion::rotation_z(FRAC_PI_2);
|
||||||
|
|
||||||
next.shoulder_l.position =
|
next.shoulder_l.position =
|
||||||
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ impl Animation for AlphaAnimation {
|
|||||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
|
|
||||||
let fast = (anim_time * 10.0).sin();
|
let fast = (anim_time * 10.0).sin();
|
||||||
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
|
let fastalt = (anim_time * 10.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let speednorm = speed / 9.4;
|
let speednorm = speed / 9.4;
|
||||||
let speednormcancel = 1.0 - speednorm;
|
let speednormcancel = 1.0 - speednorm;
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::states::utils::StageSection;
|
use common::states::utils::StageSection;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct DashAnimation;
|
pub struct DashAnimation;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ impl Animation for DashAnimation {
|
|||||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
|
|
||||||
let fast = (anim_time * 10.0).sin();
|
let fast = (anim_time * 10.0).sin();
|
||||||
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
|
let fastalt = (anim_time * 10.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let speednorm = speed / 9.4;
|
let speednorm = speed / 9.4;
|
||||||
let speednormcancel = 1.0 - speednorm;
|
let speednormcancel = 1.0 - speednorm;
|
||||||
|
@ -2,6 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ impl Animation for IdleAnimation {
|
|||||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3) * s_a.scaler / 11.0;
|
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3) * s_a.scaler / 11.0;
|
||||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||||
next.main.position = Vec3::new(2.0, -3.0, -3.0);
|
next.main.position = Vec3::new(2.0, -3.0, -3.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1);
|
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1);
|
||||||
|
@ -2,7 +2,10 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ impl Animation for RunAnimation {
|
|||||||
let footvertsl = (acc_vel * 1.4 * lab).sin();
|
let footvertsl = (acc_vel * 1.4 * lab).sin();
|
||||||
let footvertsr = (acc_vel * 1.4 * lab + PI * 0.5).sin();
|
let footvertsr = (acc_vel * 1.4 * lab + PI * 0.5).sin();
|
||||||
|
|
||||||
let shortalt = (acc_vel * lab * 1.4 + PI / 2.0).sin();
|
let shortalt = (acc_vel * lab * 1.4 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.4).sin()).powi(2))).sqrt())
|
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.4).sin()).powi(2))).sqrt())
|
||||||
* ((acc_vel * lab * 1.4).sin());
|
* ((acc_vel * lab * 1.4).sin());
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct ShootAnimation;
|
pub struct ShootAnimation;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ impl Animation for ShootAnimation {
|
|||||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
|
|
||||||
let fast = (anim_time * 10.0).sin();
|
let fast = (anim_time * 10.0).sin();
|
||||||
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
|
let fastalt = (anim_time * 10.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let speednorm = speed / 9.4;
|
let speednorm = speed / 9.4;
|
||||||
let speednormcancel = 1.0 - speednorm;
|
let speednormcancel = 1.0 - speednorm;
|
||||||
@ -104,8 +104,8 @@ impl Animation for ShootAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.3);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.3);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + s_a.grip.0 * 0.2)
|
next.control_r.orientation = Quaternion::rotation_x(FRAC_PI_2 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
|
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
|
||||||
|
|
||||||
next.control.orientation = Quaternion::rotation_x(-0.3 + move1abs * 0.4)
|
next.control.orientation = Quaternion::rotation_x(-0.3 + move1abs * 0.4)
|
||||||
@ -133,11 +133,11 @@ impl Animation for ShootAnimation {
|
|||||||
-2.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + move1abs * 5.0,
|
-2.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + move1abs * 5.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move1abs * 0.8)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 + move1abs * 0.8)
|
||||||
* Quaternion::rotation_y(-0.3)
|
* Quaternion::rotation_y(-0.3)
|
||||||
* Quaternion::rotation_z(-0.3);
|
* Quaternion::rotation_z(-0.3);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + s_a.grip.0 * 0.2 + move1abs * 0.8)
|
Quaternion::rotation_x(FRAC_PI_2 + s_a.grip.0 * 0.2 + move1abs * 0.8)
|
||||||
* Quaternion::rotation_y(-0.4 + s_a.grip.0 * 0.2 + move1abs * 0.8)
|
* Quaternion::rotation_y(-0.4 + s_a.grip.0 * 0.2 + move1abs * 0.8)
|
||||||
* Quaternion::rotation_z(-0.0);
|
* Quaternion::rotation_z(-0.0);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct StunnedAnimation;
|
pub struct StunnedAnimation;
|
||||||
|
|
||||||
@ -119,9 +119,9 @@ impl Animation for StunnedAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.3);
|
Quaternion::rotation_x(FRAC_PI_2) * Quaternion::rotation_y(-0.3);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + s_a.grip.0 * 0.2)
|
Quaternion::rotation_x(FRAC_PI_2 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
|
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
|
||||||
|
|
||||||
next.control.orientation = Quaternion::rotation_x(-0.3 + 0.5 * speednorm)
|
next.control.orientation = Quaternion::rotation_x(-0.3 + 0.5 * speednorm)
|
||||||
@ -138,11 +138,11 @@ impl Animation for StunnedAnimation {
|
|||||||
-2.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + speednorm * 2.0,
|
-2.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + speednorm * 2.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
* Quaternion::rotation_y(-0.3)
|
* Quaternion::rotation_y(-0.3)
|
||||||
* Quaternion::rotation_z(-0.3);
|
* Quaternion::rotation_z(-0.3);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + s_a.grip.0 * 0.2)
|
Quaternion::rotation_x(FRAC_PI_2 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_y(-0.4 + s_a.grip.0 * 0.2)
|
* Quaternion::rotation_y(-0.4 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_z(-0.0);
|
* Quaternion::rotation_z(-0.0);
|
||||||
|
|
||||||
@ -171,7 +171,8 @@ impl Animation for StunnedAnimation {
|
|||||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||||
next.main.position = Vec3::new(2.0, -3.0, -3.0);
|
next.main.position = Vec3::new(2.0, -3.0, -3.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct WieldAnimation;
|
pub struct WieldAnimation;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ impl Animation for WieldAnimation {
|
|||||||
|
|
||||||
let fastacc = (acc_vel * 2.0).sin();
|
let fastacc = (acc_vel * 2.0).sin();
|
||||||
let fast = (anim_time * 10.0).sin();
|
let fast = (anim_time * 10.0).sin();
|
||||||
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
|
let fastalt = (anim_time * 10.0 + FRAC_PI_2).sin();
|
||||||
let slow = (anim_time * 2.0).sin();
|
let slow = (anim_time * 2.0).sin();
|
||||||
|
|
||||||
let speednorm = speed / 9.4;
|
let speednorm = speed / 9.4;
|
||||||
@ -112,9 +112,9 @@ impl Animation for WieldAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + slow * 0.1) * Quaternion::rotation_y(-0.3);
|
Quaternion::rotation_x(FRAC_PI_2 + slow * 0.1) * Quaternion::rotation_y(-0.3);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + slow * 0.1 + s_a.grip.0 * 0.2)
|
Quaternion::rotation_x(FRAC_PI_2 + slow * 0.1 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_y(0.5 + slow * 0.0 + s_a.grip.0 * 0.2);
|
* Quaternion::rotation_y(0.5 + slow * 0.0 + s_a.grip.0 * 0.2);
|
||||||
|
|
||||||
next.control.orientation = Quaternion::rotation_x(-0.3 + 0.5 * speednorm)
|
next.control.orientation = Quaternion::rotation_x(-0.3 + 0.5 * speednorm)
|
||||||
@ -135,11 +135,11 @@ impl Animation for WieldAnimation {
|
|||||||
+ speednorm * 2.0,
|
+ speednorm * 2.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + slow * 0.1)
|
next.control_l.orientation = Quaternion::rotation_x(FRAC_PI_2 + slow * 0.1)
|
||||||
* Quaternion::rotation_y(-0.3)
|
* Quaternion::rotation_y(-0.3)
|
||||||
* Quaternion::rotation_z(-0.3);
|
* Quaternion::rotation_z(-0.3);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0 + slow * 0.1 + s_a.grip.0 * 0.2)
|
Quaternion::rotation_x(FRAC_PI_2 + slow * 0.1 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_y(-0.4 + slow * 0.0 + s_a.grip.0 * 0.2)
|
* Quaternion::rotation_y(-0.4 + slow * 0.0 + s_a.grip.0 * 0.2)
|
||||||
* Quaternion::rotation_z(-0.0);
|
* Quaternion::rotation_z(-0.0);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BirdLargeSkeleton, SkeletonAttr,
|
BirdLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -47,10 +47,10 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
//FL
|
//FL
|
||||||
let foot1a = (mixed_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
|
let foot1a = (mixed_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
|
||||||
let foot1b = (mixed_vel * 1.0 * lab * speedmult + 1.57 + PI).sin() * speednorm; //1.9
|
let foot1b = (mixed_vel * 1.0 * lab * speedmult + FRAC_PI_2 + PI).sin() * speednorm; //1.9
|
||||||
//FR
|
//FR
|
||||||
let foot2a = (mixed_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
|
let foot2a = (mixed_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
|
||||||
let foot2b = (mixed_vel * 1.0 * lab * speedmult + 1.57).sin() * speednorm; //1.6
|
let foot2b = (mixed_vel * 1.0 * lab * speedmult + FRAC_PI_2).sin() * speednorm; //1.6
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
let last_ori = Vec2::from(last_ori);
|
||||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||||
|
@ -16,7 +16,6 @@ impl Animation for SummonAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"bird_large_summon\0";
|
const UPDATE_FN: &'static [u8] = b"bird_large_summon\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_summon")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_summon")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(global_time, stage_section, timer, look_dir, on_ground): Self::Dependency<'a>,
|
(global_time, stage_section, timer, look_dir, on_ground): Self::Dependency<'a>,
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BirdMediumSkeleton, SkeletonAttr,
|
BirdMediumSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct FlyAnimation;
|
pub struct FlyAnimation;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ impl Animation for FlyAnimation {
|
|||||||
|
|
||||||
let footl = (anim_time * lab + PI).sin();
|
let footl = (anim_time * lab + PI).sin();
|
||||||
let footr = (anim_time * lab).sin();
|
let footr = (anim_time * lab).sin();
|
||||||
let center = (anim_time * lab + PI / 2.0).sin();
|
let center = (anim_time * lab + FRAC_PI_2).sin();
|
||||||
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
||||||
|
|
||||||
next.torso.scale = Vec3::one() / 11.0;
|
next.torso.scale = Vec3::one() / 11.0;
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BirdMediumSkeleton, SkeletonAttr,
|
BirdMediumSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
let footl = (anim_time * lab + PI).sin();
|
let footl = (anim_time * lab + PI).sin();
|
||||||
let footr = (anim_time * lab).sin();
|
let footr = (anim_time * lab).sin();
|
||||||
let center = (anim_time * lab + PI / 2.0).sin();
|
let center = (anim_time * lab + FRAC_PI_2).sin();
|
||||||
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
||||||
|
|
||||||
next.torso.scale = Vec3::one() / 11.0;
|
next.torso.scale = Vec3::one() / 11.0;
|
||||||
|
@ -23,7 +23,6 @@ impl Animation for AlphaAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_alpha\0";
|
const UPDATE_FN: &'static [u8] = b"character_alpha\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_alpha")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_alpha")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(hands, stage_section, ability_info): Self::Dependency<'a>,
|
(hands, stage_section, ability_info): Self::Dependency<'a>,
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, FRAC_PI_4};
|
||||||
|
|
||||||
pub struct BeamAnimation;
|
pub struct BeamAnimation;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ impl Animation for BeamAnimation {
|
|||||||
+ (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3),
|
+ (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3),
|
||||||
)
|
)
|
||||||
* Quaternion::rotation_z(
|
* Quaternion::rotation_z(
|
||||||
(move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3),
|
(move1 * -1.7 + (move2 * 8.0 + FRAC_PI_4).sin() * 0.3) * (1.0 - move3),
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
@ -79,12 +79,12 @@ impl Animation for BeamAnimation {
|
|||||||
0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3),
|
0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3),
|
||||||
0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5)
|
0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5)
|
||||||
* (1.0 - move3),
|
* (1.0 - move3),
|
||||||
-4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3),
|
-4.0 + (move1 * 19.0 + (move2 * 8.0 + FRAC_PI_2).sin() * 3.5) * (1.0 - move3),
|
||||||
);
|
);
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3))
|
Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3))
|
||||||
* Quaternion::rotation_y(
|
* Quaternion::rotation_y(
|
||||||
(move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3),
|
(move1 * -1.1 + (move2 * 8.0 + FRAC_PI_2).sin() * -0.3) * (1.0 - move3),
|
||||||
)
|
)
|
||||||
* Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3));
|
* Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3));
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::FRAC_PI_2, ops::Mul};
|
||||||
|
|
||||||
pub struct ClimbAnimation;
|
pub struct ClimbAnimation;
|
||||||
|
|
||||||
@ -34,15 +34,15 @@ impl Animation for ClimbAnimation {
|
|||||||
*rate = speed;
|
*rate = speed;
|
||||||
let constant: f32 = 1.0;
|
let constant: f32 = 1.0;
|
||||||
let smooth = (anim_time * constant * 1.5).sin();
|
let smooth = (anim_time * constant * 1.5).sin();
|
||||||
let smootha = (anim_time * constant * 1.5 + PI / 2.0).sin();
|
let smootha = (anim_time * constant * 1.5 + FRAC_PI_2).sin();
|
||||||
let drop = (anim_time * constant * 4.0 + PI / 2.0).sin();
|
let drop = (anim_time * constant * 4.0 + FRAC_PI_2).sin();
|
||||||
let dropa = (anim_time * constant * 4.0).sin();
|
let dropa = (anim_time * constant * 4.0).sin();
|
||||||
|
|
||||||
let quick = ((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5).sin()).powi(2))).sqrt())
|
let quick = ((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * constant * 1.5).sin());
|
* ((anim_time * constant * 1.5).sin());
|
||||||
let quicka =
|
let quicka =
|
||||||
((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5 + PI / 2.0).sin()).powi(2))).sqrt())
|
((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5 + FRAC_PI_2).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * constant * 1.5 + PI / 2.0).sin());
|
* ((anim_time * constant * 1.5 + FRAC_PI_2).sin());
|
||||||
let head_look = Vec2::new(
|
let head_look = Vec2::new(
|
||||||
(global_time / 2.0 + anim_time / 2.0)
|
(global_time / 2.0 + anim_time / 2.0)
|
||||||
.floor()
|
.floor()
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_4, FRAC_PI_6},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct DanceAnimation;
|
pub struct DanceAnimation;
|
||||||
|
|
||||||
@ -29,12 +32,12 @@ impl Animation for DanceAnimation {
|
|||||||
let lab: f32 = 1.0;
|
let lab: f32 = 1.0;
|
||||||
let short = ((5.0 / (3.0 + 2.0 * ((anim_time * lab * 6.0).sin()).powi(2))).sqrt())
|
let short = ((5.0 / (3.0 + 2.0 * ((anim_time * lab * 6.0).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 6.0).sin());
|
* ((anim_time * lab * 6.0).sin());
|
||||||
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
|
let noisea = (anim_time * 11.0 + FRAC_PI_6).sin();
|
||||||
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
|
let noiseb = (anim_time * 19.0 + FRAC_PI_4).sin();
|
||||||
|
|
||||||
let shorte = (anim_time * lab * 6.0).sin();
|
let shorte = (anim_time * lab * 6.0).sin();
|
||||||
|
|
||||||
let shortealt = (anim_time * lab * 6.0 + PI / 2.0).sin();
|
let shortealt = (anim_time * lab * 6.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let foot = ((5.0 / (1.0 + (4.0) * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
|
let foot = ((5.0 / (1.0 + (4.0) * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 8.0).sin());
|
* ((anim_time * lab * 8.0).sin());
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct DashAnimation;
|
pub struct DashAnimation;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ impl Animation for DashAnimation {
|
|||||||
((5.0 / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin())
|
((5.0 / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
|
fn shortalt(x: f32) -> f32 { (x * 5.0 + FRAC_PI_2).sin() }
|
||||||
|
|
||||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_4, PI};
|
||||||
|
|
||||||
pub struct EquipAnimation;
|
pub struct EquipAnimation;
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ impl Animation for EquipAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_equip\0";
|
const UPDATE_FN: &'static [u8] = b"character_equip\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_equip")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_equip")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency<'a>,
|
(active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency<'a>,
|
||||||
@ -26,7 +25,7 @@ impl Animation for EquipAnimation {
|
|||||||
*rate = 1.0;
|
*rate = 1.0;
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
|
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
|
||||||
let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos();
|
let equip_slowa = 1.0 + (anim_time * 12.0 + FRAC_PI_4).cos();
|
||||||
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
|
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
|
||||||
next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
|
next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
|
||||||
next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5);
|
next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5);
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
impl Animation for JumpAnimation {
|
impl Animation for JumpAnimation {
|
||||||
@ -155,15 +155,18 @@ impl Animation for JumpAnimation {
|
|||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Bow) => {
|
Some(ToolKind::Bow) => {
|
||||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +185,7 @@ impl Animation for JumpAnimation {
|
|||||||
_ => {
|
_ => {
|
||||||
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.second.orientation =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +214,7 @@ impl Animation for JumpAnimation {
|
|||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||||
next.main.orientation =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
@ -223,7 +226,7 @@ impl Animation for JumpAnimation {
|
|||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||||
next.second.orientation =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-1.57);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
|
@ -6,6 +6,8 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
};
|
};
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct LeapAnimation;
|
pub struct LeapAnimation;
|
||||||
|
|
||||||
type LeapAnimationDependency = (
|
type LeapAnimationDependency = (
|
||||||
@ -23,7 +25,6 @@ impl Animation for LeapAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_leapmelee\0";
|
const UPDATE_FN: &'static [u8] = b"character_leapmelee\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_leapmelee")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_leapmelee")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency<'a>,
|
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency<'a>,
|
||||||
@ -133,7 +134,7 @@ impl Animation for LeapAnimation {
|
|||||||
s_a.hc.2 + move2 * 5.0 + move3 * -10.0,
|
s_a.hc.2 + move2 * 5.0 + move3 * -10.0,
|
||||||
);
|
);
|
||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(s_a.hc.3 + move2 * 1.57 + move3 * -2.3)
|
Quaternion::rotation_x(s_a.hc.3 + move2 * FRAC_PI_2 + move3 * -2.3)
|
||||||
* Quaternion::rotation_y(s_a.hc.4 + move2 * 1.3)
|
* Quaternion::rotation_y(s_a.hc.4 + move2 * 1.3)
|
||||||
* Quaternion::rotation_z(s_a.hc.5 + move2 * -1.0 + move3 * 0.5);
|
* Quaternion::rotation_z(s_a.hc.5 + move2 * -1.0 + move3 * 0.5);
|
||||||
},
|
},
|
||||||
@ -170,7 +171,7 @@ impl Animation for LeapAnimation {
|
|||||||
Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * -2.0)
|
Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * -2.0)
|
||||||
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.9);
|
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.9);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
|
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
|
||||||
next.control_l.position = Vec3::new(
|
next.control_l.position = Vec3::new(
|
||||||
@ -181,7 +182,7 @@ impl Animation for LeapAnimation {
|
|||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5);
|
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
@ -200,7 +201,7 @@ impl Animation for LeapAnimation {
|
|||||||
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move3 * -2.2)
|
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move3 * -2.2)
|
||||||
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.2);
|
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.2);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
|
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
|
||||||
next.control_r.position = Vec3::new(
|
next.control_r.position = Vec3::new(
|
||||||
@ -212,7 +213,7 @@ impl Animation for LeapAnimation {
|
|||||||
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5)
|
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5)
|
||||||
* Quaternion::rotation_y(move2 * -0.75 + move3 * 0.75);
|
* Quaternion::rotation_y(move2 * -0.75 + move3 * 0.75);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
};
|
};
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct RepeaterAnimation;
|
pub struct RepeaterAnimation;
|
||||||
|
|
||||||
impl Animation for RepeaterAnimation {
|
impl Animation for RepeaterAnimation {
|
||||||
@ -23,7 +25,6 @@ impl Animation for RepeaterAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_repeater\0";
|
const UPDATE_FN: &'static [u8] = b"character_repeater\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_repeater")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_repeater")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(ability_info, hands, velocity, _global_time, stage_section): Self::Dependency<'a>,
|
(ability_info, hands, velocity, _global_time, stage_section): Self::Dependency<'a>,
|
||||||
@ -57,7 +58,8 @@ impl Animation for RepeaterAnimation {
|
|||||||
next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
|
next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
next.hold.position = Vec3::new(0.0, -1.0 + move3 * 2.0, -5.2);
|
next.hold.position = Vec3::new(0.0, -1.0 + move3 * 2.0, -5.2);
|
||||||
next.hold.orientation = Quaternion::rotation_x(-1.57) * Quaternion::rotation_z(0.0);
|
next.hold.orientation =
|
||||||
|
Quaternion::rotation_x(-FRAC_PI_2) * Quaternion::rotation_z(0.0);
|
||||||
next.hold.scale = Vec3::one() * (1.0);
|
next.hold.scale = Vec3::one() * (1.0);
|
||||||
if speed < 0.5 {
|
if speed < 0.5 {
|
||||||
next.foot_l.position = Vec3::new(
|
next.foot_l.position = Vec3::new(
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_4, FRAC_PI_6, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -62,8 +65,8 @@ impl Animation for RunAnimation {
|
|||||||
.sqrt())
|
.sqrt())
|
||||||
* ((acc_vel * 1.6 * lab + PI * 0.4).sin());
|
* ((acc_vel * 1.6 * lab + PI * 0.4).sin());
|
||||||
|
|
||||||
let noisea = (acc_vel * 11.0 + PI / 6.0).sin();
|
let noisea = (acc_vel * 11.0 + FRAC_PI_6).sin();
|
||||||
let noiseb = (acc_vel * 19.0 + PI / 4.0).sin();
|
let noiseb = (acc_vel * 19.0 + FRAC_PI_4).sin();
|
||||||
|
|
||||||
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
||||||
* ((acc_vel * lab * 1.6).sin());
|
* ((acc_vel * lab * 1.6).sin());
|
||||||
@ -80,7 +83,7 @@ impl Animation for RunAnimation {
|
|||||||
let footvertsl = (acc_vel * 1.6 * lab).sin();
|
let footvertsl = (acc_vel * 1.6 * lab).sin();
|
||||||
let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).sin();
|
let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).sin();
|
||||||
|
|
||||||
let shortalt = (acc_vel * lab * 1.6 + PI / 2.0).sin();
|
let shortalt = (acc_vel * lab * 1.6 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
||||||
* ((acc_vel * lab * 1.6).sin());
|
* ((acc_vel * lab * 1.6).sin());
|
||||||
|
@ -7,7 +7,7 @@ use common::{
|
|||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct ShootAnimation;
|
pub struct ShootAnimation;
|
||||||
|
|
||||||
@ -29,7 +29,6 @@ impl Animation for ShootAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_shoot\0";
|
const UPDATE_FN: &'static [u8] = b"character_shoot\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_shoot")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_shoot")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
@ -141,7 +140,7 @@ impl Animation for ShootAnimation {
|
|||||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||||
|
|
||||||
next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2 + move2 * 7.0);
|
next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2 + move2 * 7.0);
|
||||||
next.hold.orientation = Quaternion::rotation_x(-1.57);
|
next.hold.orientation = Quaternion::rotation_x(-FRAC_PI_2);
|
||||||
next.hold.scale = Vec3::one() * 1.0 * (1.0 - move2);
|
next.hold.scale = Vec3::one() * 1.0 * (1.0 - move2);
|
||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::FRAC_PI_2, ops::Mul};
|
||||||
|
|
||||||
pub struct SitAnimation;
|
pub struct SitAnimation;
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ impl Animation for SitAnimation {
|
|||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
let slow = (anim_time * 1.0).sin();
|
let slow = (anim_time * 1.0).sin();
|
||||||
let slowa = (anim_time * 1.0 + PI / 2.0).sin();
|
let slowa = (anim_time * 1.0 + FRAC_PI_2).sin();
|
||||||
let stop = (anim_time * 3.0).min(PI / 2.0).sin();
|
let stop = (anim_time * 3.0).min(FRAC_PI_2).sin();
|
||||||
|
|
||||||
let head_look = Vec2::new(
|
let head_look = Vec2::new(
|
||||||
(global_time * 0.05 + anim_time / 15.0)
|
(global_time * 0.05 + anim_time / 15.0)
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::ToolKind;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_4, FRAC_PI_6, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SneakAnimation;
|
pub struct SneakAnimation;
|
||||||
|
|
||||||
@ -47,13 +50,13 @@ impl Animation for SneakAnimation {
|
|||||||
* ((anim_time * 7.0 * lab + PI * 0.4).sin());
|
* ((anim_time * 7.0 * lab + PI * 0.4).sin());
|
||||||
|
|
||||||
let short = (anim_time * lab * 7.0).sin();
|
let short = (anim_time * lab * 7.0).sin();
|
||||||
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
|
let noisea = (anim_time * 11.0 + FRAC_PI_6).sin();
|
||||||
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
|
let noiseb = (anim_time * 19.0 + FRAC_PI_4).sin();
|
||||||
|
|
||||||
let shorte = ((5.0 / (4.0 + 1.0 * ((anim_time * lab * 7.0).sin()).powi(2))).sqrt())
|
let shorte = ((5.0 / (4.0 + 1.0 * ((anim_time * lab * 7.0).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 7.0).sin());
|
* ((anim_time * lab * 7.0).sin());
|
||||||
|
|
||||||
let shortalt = (anim_time * lab * 7.0 + PI / 2.0).sin();
|
let shortalt = (anim_time * lab * 7.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let head_look = Vec2::new(
|
let head_look = Vec2::new(
|
||||||
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
|
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct SpinAnimation;
|
pub struct SpinAnimation;
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ impl Animation for SpinAnimation {
|
|||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1base * -1.2)
|
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1base * -1.2)
|
||||||
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement2base * -0.2)
|
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement2base * -0.2)
|
||||||
* Quaternion::rotation_z(s_a.sc.5 - 1.57 + movement1base * PI);
|
* Quaternion::rotation_z(s_a.sc.5 - FRAC_PI_2 + movement1base * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) => {
|
Some(ToolKind::Axe) => {
|
||||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
||||||
@ -183,7 +183,7 @@ impl Animation for SpinAnimation {
|
|||||||
* Quaternion::rotation_y(-2.7 + movement1base * -1.0 + movement2base * 2.0)
|
* Quaternion::rotation_y(-2.7 + movement1base * -1.0 + movement2base * 2.0)
|
||||||
* Quaternion::rotation_z(1.5 + movement1base * PI);
|
* Quaternion::rotation_z(1.5 + movement1base * PI);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) => {
|
Some(ToolKind::Axe) => {
|
||||||
next.control_l.position = Vec3::new(
|
next.control_l.position = Vec3::new(
|
||||||
@ -193,9 +193,9 @@ impl Animation for SpinAnimation {
|
|||||||
);
|
);
|
||||||
next.control_l.orientation = Quaternion::rotation_x(1.7 + movement2base * 1.5)
|
next.control_l.orientation = Quaternion::rotation_x(1.7 + movement2base * 1.5)
|
||||||
* Quaternion::rotation_y(-3.7)
|
* Quaternion::rotation_y(-3.7)
|
||||||
* Quaternion::rotation_z(1.5 + movement2base * 1.57);
|
* Quaternion::rotation_z(1.5 + movement2base * FRAC_PI_2);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
@ -212,7 +212,7 @@ impl Animation for SpinAnimation {
|
|||||||
* Quaternion::rotation_y(-3.3 + move1 * -1.0 + move2 * 2.0)
|
* Quaternion::rotation_y(-3.3 + move1 * -1.0 + move2 * 2.0)
|
||||||
* Quaternion::rotation_z(1.5 + move1 * PI);
|
* Quaternion::rotation_z(1.5 + move1 * PI);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) => {
|
Some(ToolKind::Axe) => {
|
||||||
next.control_r.position = Vec3::new(
|
next.control_r.position = Vec3::new(
|
||||||
@ -222,9 +222,9 @@ impl Animation for SpinAnimation {
|
|||||||
);
|
);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(1.7 + move2 * 1.5)
|
next.control_r.orientation = Quaternion::rotation_x(1.7 + move2 * 1.5)
|
||||||
* Quaternion::rotation_y(-3.3)
|
* Quaternion::rotation_y(-3.3)
|
||||||
* Quaternion::rotation_z(1.5 + move2 * 1.57);
|
* Quaternion::rotation_z(1.5 + move2 * FRAC_PI_2);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
|
@ -6,7 +6,7 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::{AbilityInfo, StageSection},
|
states::utils::{AbilityInfo, StageSection},
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI, TAU};
|
||||||
|
|
||||||
pub struct SpinMeleeAnimation;
|
pub struct SpinMeleeAnimation;
|
||||||
|
|
||||||
@ -25,7 +25,6 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_spinmelee\0";
|
const UPDATE_FN: &'static [u8] = b"character_spinmelee\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_spinmelee")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_spinmelee")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency<'a>,
|
(hands, _velocity, _global_time, stage_section, ability_info): Self::Dependency<'a>,
|
||||||
@ -50,7 +49,7 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||||
match ability_info.and_then(|a| a.tool) {
|
match ability_info.and_then(|a| a.tool) {
|
||||||
Some(ToolKind::Sword) => {
|
Some(ToolKind::Sword) => {
|
||||||
next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0);
|
next.torso.orientation = Quaternion::rotation_z(movement2 * TAU);
|
||||||
|
|
||||||
next.chest.position = Vec3::new(
|
next.chest.position = Vec3::new(
|
||||||
0.0,
|
0.0,
|
||||||
@ -122,7 +121,7 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
s_a.sc.2 + move1 * 2.0 + move2 * 10.0,
|
s_a.sc.2 + move1 * 2.0 + move2 * 10.0,
|
||||||
);
|
);
|
||||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -PI / 2.5)
|
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -PI / 2.5)
|
||||||
* Quaternion::rotation_z(s_a.sc.5 + move1 * -PI / 2.0);
|
* Quaternion::rotation_z(s_a.sc.5 + move1 * -FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) => {
|
Some(ToolKind::Axe) => {
|
||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
@ -6,6 +6,7 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct StaggeredAnimation;
|
pub struct StaggeredAnimation;
|
||||||
|
|
||||||
@ -27,7 +28,6 @@ impl Animation for StaggeredAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_staggered\0";
|
const UPDATE_FN: &'static [u8] = b"character_staggered\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_staggered")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_staggered")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
@ -139,7 +139,7 @@ impl Animation for StaggeredAnimation {
|
|||||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||||
|
|
||||||
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
||||||
next.hold.orientation = Quaternion::rotation_x(-1.57);
|
next.hold.orientation = Quaternion::rotation_x(-FRAC_PI_2);
|
||||||
next.hold.scale = Vec3::one() * 1.0;
|
next.hold.scale = Vec3::one() * 1.0;
|
||||||
|
|
||||||
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
|
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
|
||||||
@ -150,15 +150,15 @@ impl Animation for StaggeredAnimation {
|
|||||||
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||||
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(3.14);
|
next.main.orientation = Quaternion::rotation_x(PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Farming) => {
|
Some(ToolKind::Farming) => {
|
||||||
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57);
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57);
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
||||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
next.main.orientation = Quaternion::rotation_y(PI);
|
||||||
|
|
||||||
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
|
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
|
||||||
},
|
},
|
||||||
@ -172,7 +172,7 @@ impl Animation for StaggeredAnimation {
|
|||||||
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
||||||
next.control_l.orientation = Quaternion::rotation_x(-0.3);
|
next.control_l.orientation = Quaternion::rotation_x(-0.3);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
};
|
};
|
||||||
@ -181,7 +181,7 @@ impl Animation for StaggeredAnimation {
|
|||||||
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
|
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(-0.3);
|
next.control_r.orientation = Quaternion::rotation_x(-0.3);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::ops::Mul;
|
use std::{f32::consts::FRAC_PI_2, ops::Mul};
|
||||||
|
|
||||||
pub struct StandAnimation;
|
pub struct StandAnimation;
|
||||||
|
|
||||||
@ -114,17 +114,17 @@ impl Animation for StandAnimation {
|
|||||||
Some(ToolKind::Bow) => {
|
Some(ToolKind::Bow) => {
|
||||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||||
next.main.orientation =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||||
next.main.orientation =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.main.orientation =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
((_, _), _, _) => {},
|
((_, _), _, _) => {},
|
||||||
@ -135,7 +135,7 @@ impl Animation for StandAnimation {
|
|||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||||
next.main.orientation =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
@ -147,7 +147,7 @@ impl Animation for StandAnimation {
|
|||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||||
next.second.orientation =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-1.57);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
|
@ -6,6 +6,7 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
};
|
};
|
||||||
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct StunnedAnimation;
|
pub struct StunnedAnimation;
|
||||||
|
|
||||||
@ -27,7 +28,6 @@ impl Animation for StunnedAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_stunned\0";
|
const UPDATE_FN: &'static [u8] = b"character_stunned\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_stunned")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_stunned")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
@ -135,7 +135,7 @@ impl Animation for StunnedAnimation {
|
|||||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||||
|
|
||||||
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
||||||
next.hold.orientation = Quaternion::rotation_x(-1.57);
|
next.hold.orientation = Quaternion::rotation_x(-FRAC_PI_2);
|
||||||
next.hold.scale = Vec3::one() * 1.0;
|
next.hold.scale = Vec3::one() * 1.0;
|
||||||
|
|
||||||
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
|
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
|
||||||
@ -146,15 +146,15 @@ impl Animation for StunnedAnimation {
|
|||||||
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||||
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(3.14);
|
next.main.orientation = Quaternion::rotation_x(PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Farming) => {
|
Some(ToolKind::Farming) => {
|
||||||
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57);
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57);
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
||||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
next.main.orientation = Quaternion::rotation_y(PI);
|
||||||
|
|
||||||
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
|
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
|
||||||
},
|
},
|
||||||
@ -167,7 +167,7 @@ impl Animation for StunnedAnimation {
|
|||||||
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
||||||
next.control_l.orientation = Quaternion::rotation_x(-0.3);
|
next.control_l.orientation = Quaternion::rotation_x(-0.3);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
};
|
};
|
||||||
@ -176,7 +176,7 @@ impl Animation for StunnedAnimation {
|
|||||||
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
|
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(-0.3);
|
next.control_r.orientation = Quaternion::rotation_x(-0.3);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SwimAnimation;
|
pub struct SwimAnimation;
|
||||||
|
|
||||||
@ -190,15 +193,18 @@ impl Animation for SwimAnimation {
|
|||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Bow) => {
|
Some(ToolKind::Bow) => {
|
||||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
next.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +222,7 @@ impl Animation for SwimAnimation {
|
|||||||
_ => {
|
_ => {
|
||||||
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.second.orientation =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +237,7 @@ impl Animation for SwimAnimation {
|
|||||||
};
|
};
|
||||||
next.torso.position = Vec3::new(0.0, 0.0, 1.0 - avgspeed * 0.05) * s_a.scaler;
|
next.torso.position = Vec3::new(0.0, 0.0, 1.0 - avgspeed * 0.05) * s_a.scaler;
|
||||||
next.torso.orientation = Quaternion::rotation_x(
|
next.torso.orientation = Quaternion::rotation_x(
|
||||||
(((1.0 / switch) * PI / 2.0 + avg_vel.z * 0.12).min(1.57) - PI / 2.0)
|
(((1.0 / switch) * FRAC_PI_2 + avg_vel.z * 0.12).min(FRAC_PI_2) - FRAC_PI_2)
|
||||||
+ avgspeed * avg_vel.z * -0.003,
|
+ avgspeed * avg_vel.z * -0.003,
|
||||||
) * Quaternion::rotation_y(tilt * 2.0)
|
) * Quaternion::rotation_y(tilt * 2.0)
|
||||||
* Quaternion::rotation_z(tilt * 3.0);
|
* Quaternion::rotation_z(tilt * 3.0);
|
||||||
@ -241,7 +247,7 @@ impl Animation for SwimAnimation {
|
|||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||||
next.main.orientation =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
|
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(FRAC_PI_2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
@ -253,7 +259,7 @@ impl Animation for SwimAnimation {
|
|||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||||
next.second.orientation =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-1.57);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-FRAC_PI_2);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,10 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_4, FRAC_PI_6, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SwimWieldAnimation;
|
pub struct SwimWieldAnimation;
|
||||||
|
|
||||||
@ -22,7 +25,6 @@ impl Animation for SwimWieldAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_swimwield\0";
|
const UPDATE_FN: &'static [u8] = b"character_swimwield\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_swimwield")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_swimwield")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, second_tool_kind, hands, velocity, global_time): Self::Dependency<'a>,
|
(active_tool_kind, second_tool_kind, hands, velocity, global_time): Self::Dependency<'a>,
|
||||||
@ -56,8 +58,8 @@ impl Animation for SwimWieldAnimation {
|
|||||||
let u_slowalt = (anim_time * 3.0 + PI).cos();
|
let u_slowalt = (anim_time * 3.0 + PI).cos();
|
||||||
let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt())
|
let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * lab * 16.0).sin());
|
* ((anim_time * lab * 16.0).sin());
|
||||||
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
|
let noisea = (anim_time * 11.0 + FRAC_PI_6).sin();
|
||||||
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
|
let noiseb = (anim_time * 19.0 + FRAC_PI_4).sin();
|
||||||
|
|
||||||
next.foot_l.position = Vec3::new(
|
next.foot_l.position = Vec3::new(
|
||||||
-s_a.foot.0,
|
-s_a.foot.0,
|
||||||
@ -198,12 +200,12 @@ impl Animation for SwimWieldAnimation {
|
|||||||
* Quaternion::rotation_z(PI - 0.2);
|
* Quaternion::rotation_z(PI - 0.2);
|
||||||
}
|
}
|
||||||
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
* Quaternion::rotation_z(0.0)
|
* Quaternion::rotation_z(0.0)
|
||||||
* Quaternion::rotation_y(0.0);
|
* Quaternion::rotation_y(0.0);
|
||||||
next.hand_l.scale = Vec3::one() * 1.04;
|
next.hand_l.scale = Vec3::one() * 1.04;
|
||||||
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
|
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
* Quaternion::rotation_z(0.0)
|
* Quaternion::rotation_z(0.0)
|
||||||
* Quaternion::rotation_y(0.0);
|
* Quaternion::rotation_y(0.0);
|
||||||
next.hand_r.scale = Vec3::one() * 1.04;
|
next.hand_r.scale = Vec3::one() * 1.04;
|
||||||
@ -224,8 +226,8 @@ impl Animation for SwimWieldAnimation {
|
|||||||
next.hand_r.scale = Vec3::one() * 1.04;
|
next.hand_r.scale = Vec3::one() * 1.04;
|
||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0)
|
next.main.orientation = Quaternion::rotation_x(0.0)
|
||||||
* Quaternion::rotation_y(-1.57)
|
* Quaternion::rotation_y(-FRAC_PI_2)
|
||||||
* Quaternion::rotation_z(1.57);
|
* Quaternion::rotation_z(FRAC_PI_2);
|
||||||
|
|
||||||
next.control.position = Vec3::new(6.0, 7.0, 1.0);
|
next.control.position = Vec3::new(6.0, 7.0, 1.0);
|
||||||
next.control.orientation = Quaternion::rotation_x(0.3 + u_slow * 0.15)
|
next.control.orientation = Quaternion::rotation_x(0.3 + u_slow * 0.15)
|
||||||
@ -244,7 +246,7 @@ impl Animation for SwimWieldAnimation {
|
|||||||
next.hand_r.scale = Vec3::one() * 1.04;
|
next.hand_r.scale = Vec3::one() * 1.04;
|
||||||
next.main.position = Vec3::new(12.0, 8.4, 13.2);
|
next.main.position = Vec3::new(12.0, 8.4, 13.2);
|
||||||
next.main.orientation = Quaternion::rotation_x(-0.3)
|
next.main.orientation = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(3.14 + 0.3)
|
* Quaternion::rotation_y(PI + 0.3)
|
||||||
* Quaternion::rotation_z(0.9);
|
* Quaternion::rotation_z(0.9);
|
||||||
|
|
||||||
next.control.position = Vec3::new(-14.0, 1.8, 3.0);
|
next.control.position = Vec3::new(-14.0, 1.8, 3.0);
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, util::Dir};
|
use common::{comp::item::ToolKind, util::Dir};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct TalkAnimation;
|
pub struct TalkAnimation;
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ impl Animation for TalkAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_talk\0";
|
const UPDATE_FN: &'static [u8] = b"character_talk\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_talk")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_talk")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_active_tool_kind, _second_tool_kind, _velocity, _global_time, look_dir): Self::Dependency<
|
(_active_tool_kind, _second_tool_kind, _velocity, _global_time, look_dir): Self::Dependency<
|
||||||
@ -29,8 +28,8 @@ impl Animation for TalkAnimation {
|
|||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
let slowa = (anim_time * 6.0).sin();
|
let slowa = (anim_time * 6.0).sin();
|
||||||
let slowb = (anim_time * 4.0 + PI / 2.0).sin();
|
let slowb = (anim_time * 4.0 + FRAC_PI_2).sin();
|
||||||
let slowc = (anim_time * 12.0 + PI / 2.0).sin();
|
let slowc = (anim_time * 12.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
next.head.orientation = Quaternion::rotation_x(slowc * 0.035 + look_dir.z * 0.7);
|
next.head.orientation = Quaternion::rotation_x(slowc * 0.035 + look_dir.z * 0.7);
|
||||||
next.hand_l.position = Vec3::new(
|
next.hand_l.position = Vec3::new(
|
||||||
|
@ -6,7 +6,10 @@ use common::{
|
|||||||
comp::item::{Hands, ToolKind},
|
comp::item::{Hands, ToolKind},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct WieldAnimation;
|
pub struct WieldAnimation;
|
||||||
|
|
||||||
@ -28,7 +31,6 @@ impl Animation for WieldAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"character_wield\0";
|
const UPDATE_FN: &'static [u8] = b"character_wield\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_wield")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_wield")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
@ -57,14 +59,14 @@ impl Animation for WieldAnimation {
|
|||||||
|
|
||||||
let foothoril = (anim_time * 16.0 * lab + PI * 1.45).sin();
|
let foothoril = (anim_time * 16.0 * lab + PI * 1.45).sin();
|
||||||
|
|
||||||
let beltstatic = (anim_time * 10.0 * lab + PI / 2.0).sin();
|
let beltstatic = (anim_time * 10.0 * lab + FRAC_PI_2).sin();
|
||||||
let footvertlstatic = (anim_time * 10.0 * lab).sin();
|
let footvertlstatic = (anim_time * 10.0 * lab).sin();
|
||||||
let footvertrstatic = (anim_time * 10.0 * lab + PI).sin();
|
let footvertrstatic = (anim_time * 10.0 * lab + PI).sin();
|
||||||
let footrotl =
|
let footrotl =
|
||||||
((1.0 / (0.5 + (0.5) * ((anim_time * 16.0 * lab + PI * 1.4).sin()).powi(2))).sqrt())
|
((1.0 / (0.5 + (0.5) * ((anim_time * 16.0 * lab + PI * 1.4).sin()).powi(2))).sqrt())
|
||||||
* ((anim_time * 16.0 * lab + PI * 1.4).sin());
|
* ((anim_time * 16.0 * lab + PI * 1.4).sin());
|
||||||
|
|
||||||
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
|
let shortalt = (anim_time * lab * 16.0 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let slowalt = (anim_time * 6.0 + PI).cos();
|
let slowalt = (anim_time * 6.0 + PI).cos();
|
||||||
let u_slow = (anim_time * 2.5 + PI).sin();
|
let u_slow = (anim_time * 2.5 + PI).sin();
|
||||||
@ -253,7 +255,7 @@ impl Animation for WieldAnimation {
|
|||||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||||
|
|
||||||
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
||||||
next.hold.orientation = Quaternion::rotation_x(-1.57);
|
next.hold.orientation = Quaternion::rotation_x(-FRAC_PI_2);
|
||||||
next.hold.scale = Vec3::one() * 1.0;
|
next.hold.scale = Vec3::one() * 1.0;
|
||||||
|
|
||||||
next.control.position =
|
next.control.position =
|
||||||
@ -274,11 +276,11 @@ impl Animation for WieldAnimation {
|
|||||||
* Quaternion::rotation_x(-0.2 + head_look.y.abs() + look_dir.z * 0.7);
|
* Quaternion::rotation_x(-0.2 + head_look.y.abs() + look_dir.z * 0.7);
|
||||||
}
|
}
|
||||||
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57);
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57);
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2);
|
||||||
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
||||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
next.main.orientation = Quaternion::rotation_y(PI);
|
||||||
|
|
||||||
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
|
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
|
||||||
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
|
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
|
||||||
@ -294,7 +296,7 @@ impl Animation for WieldAnimation {
|
|||||||
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
||||||
next.control_l.orientation = Quaternion::rotation_x(-0.3);
|
next.control_l.orientation = Quaternion::rotation_x(-0.3);
|
||||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(1.57)
|
next.hand_l.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
};
|
};
|
||||||
@ -303,7 +305,7 @@ impl Animation for WieldAnimation {
|
|||||||
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
|
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
|
||||||
next.control_r.orientation = Quaternion::rotation_x(-0.3);
|
next.control_r.orientation = Quaternion::rotation_x(-0.3);
|
||||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(1.57)
|
next.hand_r.orientation = Quaternion::rotation_x(FRAC_PI_2)
|
||||||
},
|
},
|
||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
DragonSkeleton, SkeletonAttr,
|
DragonSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct FlyAnimation;
|
pub struct FlyAnimation;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ impl Animation for FlyAnimation {
|
|||||||
let footl = (anim_time * lab + PI).sin();
|
let footl = (anim_time * lab + PI).sin();
|
||||||
let footr = (anim_time * lab).sin();
|
let footr = (anim_time * lab).sin();
|
||||||
|
|
||||||
let center = (anim_time * lab + PI / 2.0).sin();
|
let center = (anim_time * lab + FRAC_PI_2).sin();
|
||||||
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
||||||
|
|
||||||
next.head_upper.scale = Vec3::one() * 1.05;
|
next.head_upper.scale = Vec3::one() * 1.05;
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
DragonSkeleton, SkeletonAttr,
|
DragonSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::FRAC_PI_2, ops::Mul};
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ impl Animation for IdleAnimation {
|
|||||||
|
|
||||||
let ultra_slow = (anim_time * 1.0).sin();
|
let ultra_slow = (anim_time * 1.0).sin();
|
||||||
let slow = (anim_time * 2.5).sin();
|
let slow = (anim_time * 2.5).sin();
|
||||||
let slowalt = (anim_time * 2.5 + PI / 2.0).sin();
|
let slowalt = (anim_time * 2.5 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let dragon_look = Vec2::new(
|
let dragon_look = Vec2::new(
|
||||||
(global_time / 2.0 + anim_time / 8.0)
|
(global_time / 2.0 + anim_time / 8.0)
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
DragonSkeleton, SkeletonAttr,
|
DragonSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ impl Animation for RunAnimation {
|
|||||||
let horilboffset = (anim_time * lab + PI * 1.4).sin();
|
let horilboffset = (anim_time * lab + PI * 1.4).sin();
|
||||||
let horirb = (anim_time * lab + PI * 0.4).sin();
|
let horirb = (anim_time * lab + PI * 0.4).sin();
|
||||||
|
|
||||||
let center = (anim_time * lab + PI / 2.0).sin();
|
let center = (anim_time * lab + FRAC_PI_2).sin();
|
||||||
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
||||||
|
|
||||||
next.head_lower.scale = Vec3::one() * 1.02;
|
next.head_lower.scale = Vec3::one() * 1.02;
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
GolemSkeleton, SkeletonAttr,
|
GolemSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ impl Animation for RunAnimation {
|
|||||||
* speednorm;
|
* speednorm;
|
||||||
|
|
||||||
let short = (mixed_vel * lab * 2.0).sin() * speednorm;
|
let short = (mixed_vel * lab * 2.0).sin() * speednorm;
|
||||||
let shortalt = (mixed_vel * lab * 2.0 + PI / 2.0).sin() * speednorm;
|
let shortalt = (mixed_vel * lab * 2.0 + FRAC_PI_2).sin() * speednorm;
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
let last_ori = Vec2::from(last_ori);
|
||||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||||
|
@ -3,6 +3,8 @@ use super::{
|
|||||||
GolemSkeleton, SkeletonAttr,
|
GolemSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{states::utils::StageSection, util::Dir};
|
use common::{states::utils::StageSection, util::Dir};
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct ShootAnimation;
|
pub struct ShootAnimation;
|
||||||
|
|
||||||
impl Animation for ShootAnimation {
|
impl Animation for ShootAnimation {
|
||||||
@ -46,8 +48,9 @@ impl Animation for ShootAnimation {
|
|||||||
next.shoulder_l.orientation =
|
next.shoulder_l.orientation =
|
||||||
Quaternion::rotation_y(0.0) * Quaternion::rotation_z(move1 * 0.7);
|
Quaternion::rotation_y(0.0) * Quaternion::rotation_z(move1 * 0.7);
|
||||||
|
|
||||||
next.shoulder_r.orientation = Quaternion::rotation_x(move1 * (look_dir.z * 1.2 + 1.57))
|
next.shoulder_r.orientation =
|
||||||
* Quaternion::rotation_y(move1 * 0.0);
|
Quaternion::rotation_x(move1 * (look_dir.z * 1.2 + FRAC_PI_2))
|
||||||
|
* Quaternion::rotation_y(move1 * 0.0);
|
||||||
|
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_z(move1 * -0.3) * Quaternion::rotation_x(move1 * 1.3);
|
Quaternion::rotation_z(move1 * -0.3) * Quaternion::rotation_x(move1 * 1.3);
|
||||||
|
@ -15,7 +15,6 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"golem_spinmelee\0";
|
const UPDATE_FN: &'static [u8] = b"golem_spinmelee\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_spinmelee")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_spinmelee")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
stage_section: Self::Dependency<'a>,
|
stage_section: Self::Dependency<'a>,
|
||||||
|
@ -22,7 +22,6 @@ impl Animation for BeamAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"object_beam\0";
|
const UPDATE_FN: &'static [u8] = b"object_beam\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_beam")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_beam")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_active_tool_kind, _second_tool_kind, _stage_section, _body): Self::Dependency<'a>,
|
(_active_tool_kind, _second_tool_kind, _stage_section, _body): Self::Dependency<'a>,
|
||||||
|
@ -14,7 +14,6 @@ impl Animation for IdleAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"object_idle\0";
|
const UPDATE_FN: &'static [u8] = b"object_idle\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_idle")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_idle")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency<'a>,
|
(_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency<'a>,
|
||||||
|
@ -22,7 +22,6 @@ impl Animation for ShootAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"object_shoot\0";
|
const UPDATE_FN: &'static [u8] = b"object_shoot\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_shoot")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_shoot")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_active_tool_kind, _second_tool_kind, stage_section, body): Self::Dependency<'a>,
|
(_active_tool_kind, _second_tool_kind, stage_section, body): Self::Dependency<'a>,
|
||||||
|
@ -3,8 +3,8 @@ use super::{
|
|||||||
QuadrupedLowSkeleton, SkeletonAttr,
|
QuadrupedLowSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::states::utils::StageSection;
|
use common::states::utils::StageSection;
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
//use std::ops::Rem;
|
//use std::ops::Rem;
|
||||||
use std::f32::consts::PI;
|
|
||||||
|
|
||||||
pub struct BreatheAnimation;
|
pub struct BreatheAnimation;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ impl Animation for BreatheAnimation {
|
|||||||
let check = subtract - subtract.trunc();
|
let check = subtract - subtract.trunc();
|
||||||
let mirror = (check - 0.5).signum();
|
let mirror = (check - 0.5).signum();
|
||||||
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
|
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
|
||||||
let twitch2alt = mirror * (twitch * 20.0 + PI / 2.0).sin() * pullback;
|
let twitch2alt = mirror * (twitch * 20.0 + FRAC_PI_2).sin() * pullback;
|
||||||
|
|
||||||
let movement1abs = movement1base * pullback;
|
let movement1abs = movement1base * pullback;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
QuadrupedLowSkeleton, SkeletonAttr,
|
QuadrupedLowSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::FRAC_PI_2, ops::Mul};
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ impl Animation for IdleAnimation {
|
|||||||
|
|
||||||
let slower = (anim_time * 1.25).sin();
|
let slower = (anim_time * 1.25).sin();
|
||||||
let slow = (anim_time * 2.5).sin();
|
let slow = (anim_time * 2.5).sin();
|
||||||
let slowalt = (anim_time * 2.5 + PI / 2.0).sin();
|
let slowalt = (anim_time * 2.5 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let dragon_look = Vec2::new(
|
let dragon_look = Vec2::new(
|
||||||
(global_time / 2.0 + anim_time / 8.0)
|
(global_time / 2.0 + anim_time / 8.0)
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
QuadrupedMediumSkeleton, SkeletonAttr,
|
QuadrupedMediumSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::states::utils::StageSection;
|
use common::states::utils::StageSection;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
pub struct HoofAnimation;
|
pub struct HoofAnimation;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ impl Animation for HoofAnimation {
|
|||||||
let movement1abs = movement1base * pullback;
|
let movement1abs = movement1base * pullback;
|
||||||
let movement2abs = movement2base * pullback;
|
let movement2abs = movement2base * pullback;
|
||||||
let twitchleft = (twitch * 16.0).sin() * pullback * mirror;
|
let twitchleft = (twitch * 16.0).sin() * pullback * mirror;
|
||||||
let twitchright = (twitch * 8.0 + PI / 2.0).sin() * pullback * mirror;
|
let twitchright = (twitch * 8.0 + FRAC_PI_2).sin() * pullback * mirror;
|
||||||
|
|
||||||
next.head.orientation = Quaternion::rotation_x(movement1abs * -0.6 + movement2abs * 0.6)
|
next.head.orientation = Quaternion::rotation_x(movement1abs * -0.6 + movement2abs * 0.6)
|
||||||
* Quaternion::rotation_y(movement1 * 0.35 + movement2 * -0.15)
|
* Quaternion::rotation_y(movement1 * 0.35 + movement2 * -0.15)
|
||||||
|
@ -2,7 +2,10 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
QuadrupedMediumSkeleton, SkeletonAttr,
|
QuadrupedMediumSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{
|
||||||
|
f32::consts::{FRAC_PI_2, FRAC_PI_4, PI},
|
||||||
|
ops::Mul,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -55,10 +58,10 @@ impl Animation for RunAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 24.0 };
|
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 24.0 };
|
||||||
let shift1 = speedadjust - PI / 2.0 - speedadjust * PI * 3.0 / 4.0;
|
let shift1 = speedadjust - FRAC_PI_2 - speedadjust * PI * 3.0 / 4.0;
|
||||||
let shift2 = speedadjust + PI / 2.0 + speedadjust * PI / 2.0;
|
let shift2 = speedadjust + FRAC_PI_2 + speedadjust * FRAC_PI_2;
|
||||||
let shift3 = speedadjust + PI / 4.0 - speedadjust * PI / 4.0;
|
let shift3 = speedadjust + FRAC_PI_4 - speedadjust * FRAC_PI_4;
|
||||||
let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * PI / 2.0;
|
let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * FRAC_PI_2;
|
||||||
|
|
||||||
//FL
|
//FL
|
||||||
let foot1a = (mixed_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5
|
let foot1a = (mixed_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5
|
||||||
@ -68,10 +71,11 @@ impl Animation for RunAnimation {
|
|||||||
let foot2b = (mixed_vel * (1.0) * lab * speedmult + 1.1 + shift2).sin(); //1.0
|
let foot2b = (mixed_vel * (1.0) * lab * speedmult + 1.1 + shift2).sin(); //1.0
|
||||||
//BL
|
//BL
|
||||||
let foot3a = (mixed_vel * (1.0) * lab * speedmult + shift3).sin(); //0.0
|
let foot3a = (mixed_vel * (1.0) * lab * speedmult + shift3).sin(); //0.0
|
||||||
let foot3b = (mixed_vel * (1.0) * lab * speedmult + 1.57 + shift3).sin(); //0.4
|
let foot3b = (mixed_vel * (1.0) * lab * speedmult + FRAC_PI_2 + shift3).sin(); //0.4
|
||||||
//BR
|
//BR
|
||||||
let foot4a = (mixed_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3
|
let foot4a = (mixed_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3
|
||||||
let foot4b = (mixed_vel * (1.0) * lab * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); //0.7
|
let foot4b =
|
||||||
|
(mixed_vel * (1.0) * lab * speedmult + FRAC_PI_2 + canceler * 0.05 + shift4).sin(); //0.7
|
||||||
//
|
//
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
let last_ori = Vec2::from(last_ori);
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
QuadrupedSmallSkeleton, SkeletonAttr,
|
QuadrupedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::FRAC_PI_2, ops::Mul};
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ impl Animation for IdleAnimation {
|
|||||||
|
|
||||||
let slow = (anim_time * 3.5).sin();
|
let slow = (anim_time * 3.5).sin();
|
||||||
|
|
||||||
let slow_alt = (anim_time * 3.5 + PI / 2.0).sin();
|
let slow_alt = (anim_time * 3.5 + FRAC_PI_2).sin();
|
||||||
|
|
||||||
let head_look = Vec2::new(
|
let head_look = Vec2::new(
|
||||||
(global_time / 2.0 + anim_time / 8.0)
|
(global_time / 2.0 + anim_time / 8.0)
|
||||||
|
@ -21,7 +21,6 @@ impl Animation for IdleAnimation {
|
|||||||
const UPDATE_FN: &'static [u8] = b"ship_idle\0";
|
const UPDATE_FN: &'static [u8] = b"ship_idle\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "ship_idle")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "ship_idle")]
|
||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
|
||||||
fn update_skeleton_inner<'a>(
|
fn update_skeleton_inner<'a>(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_active_tool_kind, _second_tool_kind, _global_time, acc_vel, orientation, last_ori): Self::Dependency<'a>,
|
(_active_tool_kind, _second_tool_kind, _global_time, acc_vel, orientation, last_ori): Self::Dependency<'a>,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::{super::Animation, SkeletonAttr, TheropodSkeleton};
|
use super::{super::Animation, SkeletonAttr, TheropodSkeleton};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use super::super::vek::*;
|
use super::super::vek::*;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -43,10 +43,10 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
//FL
|
//FL
|
||||||
let foot1a = (mixed_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
|
let foot1a = (mixed_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
|
||||||
let foot1b = (mixed_vel * 1.0 * lab * speedmult + 1.57 + PI).sin() * speednorm; //1.9
|
let foot1b = (mixed_vel * 1.0 * lab * speedmult + FRAC_PI_2 + PI).sin() * speednorm; //1.9
|
||||||
//FR
|
//FR
|
||||||
let foot2a = (mixed_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
|
let foot2a = (mixed_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
|
||||||
let foot2b = (mixed_vel * 1.0 * lab * speedmult + 1.57).sin() * speednorm; //1.6
|
let foot2b = (mixed_vel * 1.0 * lab * speedmult + FRAC_PI_2).sin() * speednorm; //1.6
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
let last_ori = Vec2::from(last_ori);
|
||||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||||
|
@ -11,7 +11,7 @@ use conrod_core::image::Id;
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use image::DynamicImage;
|
use image::DynamicImage;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
use std::{f32::consts::PI, sync::Arc};
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -84,9 +84,9 @@ impl ImageSpec {
|
|||||||
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom) => Graphic::Voxel(
|
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom) => Graphic::Voxel(
|
||||||
graceful_load_segment_no_skin(specifier),
|
graceful_load_segment_no_skin(specifier),
|
||||||
Transform {
|
Transform {
|
||||||
ori: Quaternion::rotation_x(rot_x * std::f32::consts::PI / 180.0)
|
ori: Quaternion::rotation_x(rot_x * PI / 180.0)
|
||||||
.rotated_y(rot_y * std::f32::consts::PI / 180.0)
|
.rotated_y(rot_y * PI / 180.0)
|
||||||
.rotated_z(rot_z * std::f32::consts::PI / 180.0),
|
.rotated_z(rot_z * PI / 180.0),
|
||||||
offset: Vec3::from(*offset),
|
offset: Vec3::from(*offset),
|
||||||
zoom: *zoom,
|
zoom: *zoom,
|
||||||
orth: true, // TODO: Is this what we want here? @Pfau
|
orth: true, // TODO: Is this what we want here? @Pfau
|
||||||
|
@ -16,6 +16,7 @@ use super::{Consts, Texture};
|
|||||||
use crate::scene::camera::CameraMode;
|
use crate::scene::camera::CameraMode;
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use common::terrain::BlockKind;
|
use common::terrain::BlockKind;
|
||||||
|
use std::f32::consts::TAU;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
// TODO: auto insert these into shaders
|
// TODO: auto insert these into shaders
|
||||||
@ -150,7 +151,7 @@ impl Globals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_angle_rad(time_of_day: f64) -> f32 {
|
fn get_angle_rad(time_of_day: f64) -> f32 {
|
||||||
const TIME_FACTOR: f32 = (std::f32::consts::PI * 2.0) / (3600.0 * 24.0);
|
const TIME_FACTOR: f32 = TAU / (3600.0 * 24.0);
|
||||||
time_of_day as f32 * TIME_FACTOR
|
time_of_day as f32 * TIME_FACTOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ use common::{terrain::TerrainGrid, vol::ReadVol};
|
|||||||
use common_base::span;
|
use common_base::span;
|
||||||
use core::{f32::consts::PI, fmt::Debug};
|
use core::{f32::consts::PI, fmt::Debug};
|
||||||
use num::traits::{real::Real, FloatConst};
|
use num::traits::{real::Real, FloatConst};
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
use treeculler::Frustum;
|
use treeculler::Frustum;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ fn clamp_and_modulate(ori: Vec3<f32>) -> Vec3<f32> {
|
|||||||
// Wrap camera yaw
|
// Wrap camera yaw
|
||||||
x: ori.x.rem_euclid(2.0 * PI),
|
x: ori.x.rem_euclid(2.0 * PI),
|
||||||
// Clamp camera pitch to the vertical limits
|
// Clamp camera pitch to the vertical limits
|
||||||
y: ori.y.min(PI / 2.0 - 0.0001).max(-PI / 2.0 + 0.0001),
|
y: ori.y.min(FRAC_PI_2 - 0.0001).max(-FRAC_PI_2 + 0.0001),
|
||||||
// Wrap camera roll
|
// Wrap camera roll
|
||||||
z: ori.z.rem_euclid(2.0 * PI),
|
z: ori.z.rem_euclid(2.0 * PI),
|
||||||
}
|
}
|
||||||
@ -124,7 +125,7 @@ fn clamp_and_modulate(ori: Vec3<f32>) -> Vec3<f32> {
|
|||||||
/// case) the change in the integer representation of the mantissa at z=n/2:
|
/// case) the change in the integer representation of the mantissa at z=n/2:
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// e = floor(ln(near/(far - near))/ln(2))
|
/// e = floor(ln(near/(far - near))/std::f32::consts::LN_2)
|
||||||
/// db/dz = 2^(2-e) / ((1 / far - 1 / near) * (far)^2)
|
/// db/dz = 2^(2-e) / ((1 / far - 1 / near) * (far)^2)
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
@ -379,7 +380,7 @@ impl Camera {
|
|||||||
* Mat4::rotation_z(self.ori.z)
|
* Mat4::rotation_z(self.ori.z)
|
||||||
* Mat4::rotation_x(self.ori.y)
|
* Mat4::rotation_x(self.ori.y)
|
||||||
* Mat4::rotation_y(self.ori.x)
|
* Mat4::rotation_y(self.ori.x)
|
||||||
* Mat4::rotation_3d(PI / 2.0, -Vec4::unit_x())
|
* Mat4::rotation_3d(FRAC_PI_2, -Vec4::unit_x())
|
||||||
* Mat4::translation_3d(-self.focus.map(|e| e.fract()));
|
* Mat4::translation_3d(-self.focus.map(|e| e.fract()));
|
||||||
self.dependents.view_mat_inv = self.dependents.view_mat.inverted();
|
self.dependents.view_mat_inv = self.dependents.view_mat.inverted();
|
||||||
|
|
||||||
@ -415,8 +416,8 @@ impl Camera {
|
|||||||
self.tgt_ori.x = (self.tgt_ori.x + delta.x).rem_euclid(2.0 * PI);
|
self.tgt_ori.x = (self.tgt_ori.x + delta.x).rem_euclid(2.0 * PI);
|
||||||
// Clamp camera pitch to the vertical limits
|
// Clamp camera pitch to the vertical limits
|
||||||
self.tgt_ori.y = (self.tgt_ori.y + delta.y)
|
self.tgt_ori.y = (self.tgt_ori.y + delta.y)
|
||||||
.min(PI / 2.0 - 0.001)
|
.min(FRAC_PI_2 - 0.001)
|
||||||
.max(-PI / 2.0 + 0.001);
|
.max(-FRAC_PI_2 + 0.001);
|
||||||
// Wrap camera roll
|
// Wrap camera roll
|
||||||
self.tgt_ori.z = (self.tgt_ori.z + delta.z).rem_euclid(2.0 * PI);
|
self.tgt_ori.z = (self.tgt_ori.z + delta.z).rem_euclid(2.0 * PI);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use settings_change::Language::ChangeLanguage;
|
use settings_change::Language::ChangeLanguage;
|
||||||
|
use std::f32::consts::PI;
|
||||||
#[cfg(feature = "egui-ui")]
|
#[cfg(feature = "egui-ui")]
|
||||||
use voxygen_egui::EguiDebugInfo;
|
use voxygen_egui::EguiDebugInfo;
|
||||||
|
|
||||||
@ -887,7 +888,7 @@ impl PlayState for SessionState {
|
|||||||
+ input_vec.x
|
+ input_vec.x
|
||||||
* (3.0 - input_vec.y * 1.5 * if is_aiming { 1.5 } else { 1.0 })
|
* (3.0 - input_vec.y * 1.5 * if is_aiming { 1.5 } else { 1.0 })
|
||||||
* dt,
|
* dt,
|
||||||
std::f32::consts::PI * if is_aiming { 0.015 } else { 0.1 },
|
PI * if is_aiming { 0.015 } else { 0.1 },
|
||||||
0.0,
|
0.0,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ use common::{
|
|||||||
assets::{self, AssetExt, DotVoxAsset, Error},
|
assets::{self, AssetExt, DotVoxAsset, Error},
|
||||||
figure::Segment,
|
figure::Segment,
|
||||||
};
|
};
|
||||||
use std::sync::Arc;
|
use std::{f32::consts::FRAC_PI_2, sync::Arc};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
pub enum BlankGraphic {}
|
pub enum BlankGraphic {}
|
||||||
@ -48,7 +48,7 @@ impl<'a> GraphicCreator<'a> for VoxelGraphic {
|
|||||||
Ok(Graphic::Voxel(
|
Ok(Graphic::Voxel(
|
||||||
load_segment(specifier)?,
|
load_segment(specifier)?,
|
||||||
Transform {
|
Transform {
|
||||||
ori: Quaternion::rotation_x(-std::f32::consts::PI / 2.0),
|
ori: Quaternion::rotation_x(-FRAC_PI_2),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
SampleStrat::None,
|
SampleStrat::None,
|
||||||
@ -62,7 +62,7 @@ impl<'a> GraphicCreator<'a> for VoxelSsGraphic {
|
|||||||
Ok(Graphic::Voxel(
|
Ok(Graphic::Voxel(
|
||||||
load_segment(specifier.0)?,
|
load_segment(specifier.0)?,
|
||||||
Transform {
|
Transform {
|
||||||
ori: Quaternion::rotation_x(-std::f32::consts::PI / 2.0),
|
ori: Quaternion::rotation_x(-FRAC_PI_2),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
SampleStrat::SuperSampling(specifier.1),
|
SampleStrat::SuperSampling(specifier.1),
|
||||||
@ -76,7 +76,7 @@ impl<'a> GraphicCreator<'a> for VoxelSs4Graphic {
|
|||||||
Ok(Graphic::Voxel(
|
Ok(Graphic::Voxel(
|
||||||
load_segment(specifier)?,
|
load_segment(specifier)?,
|
||||||
Transform {
|
Transform {
|
||||||
ori: Quaternion::rotation_x(-std::f32::consts::PI / 2.0),
|
ori: Quaternion::rotation_x(-FRAC_PI_2),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
SampleStrat::SuperSampling(4),
|
SampleStrat::SuperSampling(4),
|
||||||
@ -90,7 +90,7 @@ impl<'a> GraphicCreator<'a> for VoxelSs9Graphic {
|
|||||||
Ok(Graphic::Voxel(
|
Ok(Graphic::Voxel(
|
||||||
load_segment(specifier)?,
|
load_segment(specifier)?,
|
||||||
Transform {
|
Transform {
|
||||||
ori: Quaternion::rotation_x(-std::f32::consts::PI / 2.0),
|
ori: Quaternion::rotation_x(-FRAC_PI_2),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
SampleStrat::SuperSampling(9),
|
SampleStrat::SuperSampling(9),
|
||||||
@ -104,7 +104,7 @@ impl<'a> GraphicCreator<'a> for VoxelPixArtGraphic {
|
|||||||
Ok(Graphic::Voxel(
|
Ok(Graphic::Voxel(
|
||||||
load_segment(specifier)?,
|
load_segment(specifier)?,
|
||||||
Transform {
|
Transform {
|
||||||
ori: Quaternion::rotation_x(-std::f32::consts::PI / 2.0),
|
ori: Quaternion::rotation_x(-FRAC_PI_2),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
SampleStrat::PixelCoverage,
|
SampleStrat::PixelCoverage,
|
||||||
|
@ -23,6 +23,7 @@ use fxhash::FxHasher64;
|
|||||||
use hashbrown::{HashMap, HashSet};
|
use hashbrown::{HashMap, HashSet};
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use rand_chacha::ChaChaRng;
|
use rand_chacha::ChaChaRng;
|
||||||
|
use std::f32::consts::FRAC_PI_2;
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{debug, info, warn};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -289,7 +290,7 @@ impl Civs {
|
|||||||
|
|
||||||
let path = (-100..100)
|
let path = (-100..100)
|
||||||
.filter_map(|i: i32| {
|
.filter_map(|i: i32| {
|
||||||
let depth = (i.abs() as f32 / 100.0 * std::f32::consts::PI / 2.0).cos();
|
let depth = (i.abs() as f32 / 100.0 * FRAC_PI_2).cos();
|
||||||
vel = (vel
|
vel = (vel
|
||||||
+ Vec2::new(
|
+ Vec2::new(
|
||||||
ctx.rng.gen_range(-0.35..0.35),
|
ctx.rng.gen_range(-0.35..0.35),
|
||||||
|
@ -16,7 +16,7 @@ use common::{
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use std::{f32, ops::Range};
|
use std::{f32, f32::consts::TAU, ops::Range};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
@ -451,7 +451,7 @@ impl ProceduralTree {
|
|||||||
.cross(Vec3::<f32>::zero().map(|_| rng.gen_range(-1.0..1.0)))
|
.cross(Vec3::<f32>::zero().map(|_| rng.gen_range(-1.0..1.0)))
|
||||||
.normalized();
|
.normalized();
|
||||||
let y_axis = dir.cross(x_axis).normalized();
|
let y_axis = dir.cross(x_axis).normalized();
|
||||||
let screw_shift = rng.gen_range(0.0..f32::consts::TAU);
|
let screw_shift = rng.gen_range(0.0..TAU);
|
||||||
|
|
||||||
let splits = rng.gen_range(config.splits.clone()).round() as usize;
|
let splits = rng.gen_range(config.splits.clone()).round() as usize;
|
||||||
for i in 0..splits {
|
for i in 0..splits {
|
||||||
@ -459,7 +459,7 @@ impl ProceduralTree {
|
|||||||
let dist = Lerp::lerp(rng.gen_range(0.0..1.0), proportion, config.proportionality);
|
let dist = Lerp::lerp(rng.gen_range(0.0..1.0), proportion, config.proportionality);
|
||||||
|
|
||||||
const PHI: f32 = 0.618;
|
const PHI: f32 = 0.618;
|
||||||
const RAD_PER_BRANCH: f32 = f32::consts::TAU * PHI;
|
const RAD_PER_BRANCH: f32 = TAU * PHI;
|
||||||
let screw = (screw_shift + i as f32 * RAD_PER_BRANCH).sin() * x_axis
|
let screw = (screw_shift + i as f32 * RAD_PER_BRANCH).sin() * x_axis
|
||||||
+ (screw_shift + i as f32 * RAD_PER_BRANCH).cos() * y_axis;
|
+ (screw_shift + i as f32 * RAD_PER_BRANCH).cos() * y_axis;
|
||||||
|
|
||||||
@ -648,10 +648,9 @@ impl Branch {
|
|||||||
{
|
{
|
||||||
let rpos = pos.xy() - p;
|
let rpos = pos.xy() - p;
|
||||||
let stretch = 32.0;
|
let stretch = 32.0;
|
||||||
let stair_section =
|
let stair_section = ((rpos.x as f32).atan2(rpos.y as f32) / TAU * stretch
|
||||||
((rpos.x as f32).atan2(rpos.y as f32) / (f32::consts::PI * 2.0) * stretch
|
+ pos.z)
|
||||||
+ pos.z)
|
.rem_euclid(stretch);
|
||||||
.rem_euclid(stretch);
|
|
||||||
(
|
(
|
||||||
stair_section < stair_thickness,
|
stair_section < stair_thickness,
|
||||||
stair_section >= stair_thickness
|
stair_section >= stair_thickness
|
||||||
|
@ -581,10 +581,10 @@ pub struct HybridMulti {
|
|||||||
|
|
||||||
impl HybridMulti {
|
impl HybridMulti {
|
||||||
pub const DEFAULT_FREQUENCY: f64 = 2.0;
|
pub const DEFAULT_FREQUENCY: f64 = 2.0;
|
||||||
pub const DEFAULT_LACUNARITY: f64 = /* std::f64::consts::PI * 2.0 / 3.0 */ 2.0;
|
pub const DEFAULT_LACUNARITY: f64 = /* std::f64::consts::TAU / 3.0 */ 2.0;
|
||||||
pub const DEFAULT_OCTAVES: usize = 6;
|
pub const DEFAULT_OCTAVES: usize = 6;
|
||||||
pub const DEFAULT_OFFSET: f64 = /* 0.25 *//* 0.5 */ 0.7;
|
pub const DEFAULT_OFFSET: f64 = /* 0.25 *//* 0.5 */ 0.7;
|
||||||
// -ln(2^(-0.25))/ln(2) = 0.25
|
// -ln(2^(-0.25))/std::f32::consts::LN_2 = 0.25
|
||||||
// 2^(-0.25) ~ 13/16
|
// 2^(-0.25) ~ 13/16
|
||||||
pub const DEFAULT_PERSISTENCE: f64 = /* 0.25 *//* 0.5 */ 13.0 / 16.0;
|
pub const DEFAULT_PERSISTENCE: f64 = /* 0.25 *//* 0.5 */ 13.0 / 16.0;
|
||||||
pub const DEFAULT_SEED: u32 = 0;
|
pub const DEFAULT_SEED: u32 = 0;
|
||||||
|
@ -19,6 +19,7 @@ use common::{
|
|||||||
use core::f32;
|
use core::f32;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::f32::consts::TAU;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
struct Keep {
|
struct Keep {
|
||||||
@ -91,7 +92,7 @@ impl Castle {
|
|||||||
|
|
||||||
towers: (0..boundary_towers)
|
towers: (0..boundary_towers)
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
let angle = (i as f32 / boundary_towers as f32) * f32::consts::PI * 2.0;
|
let angle = (i as f32 / boundary_towers as f32) * TAU;
|
||||||
let dir = Vec2::new(angle.cos(), angle.sin());
|
let dir = Vec2::new(angle.cos(), angle.sin());
|
||||||
let dist = radius as f32 + ((angle * boundary_noise).sin() - 1.0) * 40.0;
|
let dist = radius as f32 + ((angle * boundary_noise).sin() - 1.0) * 40.0;
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ impl Castle {
|
|||||||
evil: ctx.rng.gen(),
|
evil: ctx.rng.gen(),
|
||||||
keeps: (0..keep_count)
|
keeps: (0..keep_count)
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
let angle = (i as f32 / keep_count as f32) * f32::consts::PI * 2.0;
|
let angle = (i as f32 / keep_count as f32) * TAU;
|
||||||
let dir = Vec2::new(angle.cos(), angle.sin());
|
let dir = Vec2::new(angle.cos(), angle.sin());
|
||||||
let dist =
|
let dist =
|
||||||
(radius as f32 + ((angle * boundary_noise).sin() - 1.0) * 40.0) * 0.3;
|
(radius as f32 + ((angle * boundary_noise).sin() - 1.0) * 40.0) * 0.3;
|
||||||
|
@ -10,6 +10,7 @@ use common::{
|
|||||||
};
|
};
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::f32::consts::TAU;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
@ -177,8 +178,7 @@ impl Archetype for Keep {
|
|||||||
if (pos.xy().magnitude_squared() as f32) < inner_radius.powi(2) {
|
if (pos.xy().magnitude_squared() as f32) < inner_radius.powi(2) {
|
||||||
stone
|
stone
|
||||||
} else if (pos.xy().magnitude_squared() as f32) < radius.powi(2) {
|
} else if (pos.xy().magnitude_squared() as f32) < radius.powi(2) {
|
||||||
if ((pos.x as f32).atan2(pos.y as f32) / (std::f32::consts::PI * 2.0) * stretch
|
if ((pos.x as f32).atan2(pos.y as f32) / TAU * stretch + pos.z as f32)
|
||||||
+ pos.z as f32)
|
|
||||||
.rem_euclid(stretch)
|
.rem_euclid(stretch)
|
||||||
< 1.5
|
< 1.5
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,7 @@ use std::{
|
|||||||
cmp::{self, min},
|
cmp::{self, min},
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
f32,
|
f32,
|
||||||
|
f32::consts::{FRAC_PI_2, TAU},
|
||||||
hash::BuildHasherDefault,
|
hash::BuildHasherDefault,
|
||||||
};
|
};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
@ -241,8 +242,8 @@ impl Settlement {
|
|||||||
let river_offs = Vec2::new(rng.gen_range(-3..4), rng.gen_range(-3..4));
|
let river_offs = Vec2::new(rng.gen_range(-3..4), rng.gen_range(-3..4));
|
||||||
|
|
||||||
for x in (0..100).map(|e| e as f32 / 100.0) {
|
for x in (0..100).map(|e| e as f32 / 100.0) {
|
||||||
let theta0 = x as f32 * f32::consts::PI * 2.0;
|
let theta0 = x as f32 * TAU;
|
||||||
let theta1 = (x + 0.01) as f32 * f32::consts::PI * 2.0;
|
let theta1 = (x + 0.01) as f32 * TAU;
|
||||||
|
|
||||||
let pos0 = (river_dir * radius + Vec2::new(theta0.sin(), theta0.cos()) * radius)
|
let pos0 = (river_dir * radius + Vec2::new(theta0.sin(), theta0.cos()) * radius)
|
||||||
.map(|e| e.floor() as i32)
|
.map(|e| e.floor() as i32)
|
||||||
@ -641,7 +642,7 @@ impl Settlement {
|
|||||||
Some(Plot::Town { .. }) => {
|
Some(Plot::Town { .. }) => {
|
||||||
if let Some((_, path_nearest, _, _)) = col_sample.path {
|
if let Some((_, path_nearest, _, _)) = col_sample.path {
|
||||||
let path_dir = (path_nearest - wpos2d.map(|e| e as f32))
|
let path_dir = (path_nearest - wpos2d.map(|e| e as f32))
|
||||||
.rotated_z(f32::consts::PI / 2.0)
|
.rotated_z(FRAC_PI_2)
|
||||||
.normalized();
|
.normalized();
|
||||||
let is_lamp = if path_dir.x.abs() > path_dir.y.abs() {
|
let is_lamp = if path_dir.x.abs() > path_dir.y.abs() {
|
||||||
wpos2d.x as f32 % 15.0 / path_dir.dot(Vec2::unit_y()).abs()
|
wpos2d.x as f32 % 15.0 / path_dir.dot(Vec2::unit_y()).abs()
|
||||||
|
@ -22,7 +22,7 @@ use fxhash::FxHasher64;
|
|||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rand::{prelude::*, seq::SliceRandom};
|
use rand::{prelude::*, seq::SliceRandom};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::sync::Arc;
|
use std::{f32::consts::TAU, sync::Arc};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
pub struct Dungeon {
|
pub struct Dungeon {
|
||||||
@ -948,8 +948,7 @@ pub fn spiral_staircase(
|
|||||||
if (pos.xy().magnitude_squared() as f32) < inner_radius.powi(2) {
|
if (pos.xy().magnitude_squared() as f32) < inner_radius.powi(2) {
|
||||||
true
|
true
|
||||||
} else if (pos.xy().magnitude_squared() as f32) < radius.powi(2) {
|
} else if (pos.xy().magnitude_squared() as f32) < radius.powi(2) {
|
||||||
((pos.x as f32).atan2(pos.y as f32) / (f32::consts::PI * 2.0) * stretch + pos.z as f32)
|
((pos.x as f32).atan2(pos.y as f32) / TAU * stretch + pos.z as f32).rem_euclid(stretch)
|
||||||
.rem_euclid(stretch)
|
|
||||||
< 1.5
|
< 1.5
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
@ -965,8 +964,7 @@ pub fn wall_staircase(
|
|||||||
Box::new(move |pos: Vec3<i32>| {
|
Box::new(move |pos: Vec3<i32>| {
|
||||||
let pos = pos - origin;
|
let pos = pos - origin;
|
||||||
if (pos.x.abs().max(pos.y.abs())) as f32 > 0.6 * radius {
|
if (pos.x.abs().max(pos.y.abs())) as f32 > 0.6 * radius {
|
||||||
((pos.x as f32).atan2(pos.y as f32) / (f32::consts::PI * 2.0) * stretch + pos.z as f32)
|
((pos.x as f32).atan2(pos.y as f32) / TAU * stretch + pos.z as f32).rem_euclid(stretch)
|
||||||
.rem_euclid(stretch)
|
|
||||||
< 1.0
|
< 1.0
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
@ -980,7 +978,6 @@ pub fn inscribed_polystar(
|
|||||||
sides: usize,
|
sides: usize,
|
||||||
) -> Box<dyn Fn(Vec3<i32>) -> bool> {
|
) -> Box<dyn Fn(Vec3<i32>) -> bool> {
|
||||||
Box::new(move |pos| {
|
Box::new(move |pos| {
|
||||||
use std::f32::consts::TAU;
|
|
||||||
let rpos: Vec2<f32> = pos.xy().as_() - origin.as_();
|
let rpos: Vec2<f32> = pos.xy().as_() - origin.as_();
|
||||||
let is_border = rpos.magnitude_squared() > (radius - 2.0).powi(2);
|
let is_border = rpos.magnitude_squared() > (radius - 2.0).powi(2);
|
||||||
let is_line = (0..sides).into_iter().any(|i| {
|
let is_line = (0..sides).into_iter().any(|i| {
|
||||||
|
Loading…
Reference in New Issue
Block a user