pub struct Character {
pub desc: CharacterDescription,
pub position: [f32; 3],
pub yaw: f32,
pub direction: [f32; 3],
pub speed: f32,
pub target_heading: f32,
pub flag_28: bool,
pub scale: f32,
pub animation: AnimationStack,
pub stack: ActionStack,
pub tree_slot: i32,
}Expand description
The character state the actions drive.
Fields§
§desc: CharacterDescriptionThe character description: speeds and turning.
position: [f32; 3]The position of the model.
yaw: f32The heading in degrees, including the model’s yaw offset.
direction: [f32; 3]The walking direction.
speed: f32The walking speed.
target_heading: f32The heading it turns towards.
flag_28: boolSet with a heading of its own, cleared when a waypoint is faced; no byte read of it was found in the Application outside the saves, which keep it.
Original: FUN_14010f5b0.
scale: f32The model’s z scale, which scales the walking speed.
animation: AnimationStackThe model’s animation state, its clips blending into each other.
stack: ActionStackThe actions it runs.
tree_slot: i32Its slot in the characters’ tree (Game), −1 while in none.
Implementations§
Source§impl Character
impl Character
Sourcepub fn new(
desc: CharacterDescription,
position: [f32; 3],
scale: f32,
) -> Character
pub fn new( desc: CharacterDescription, position: [f32; 3], scale: f32, ) -> Character
A character at a position, with its description and its model’s scale.
Sourcepub fn play(&mut self, anim: usize, group: &AnimationGroup, speed: f32)
pub fn play(&mut self, anim: usize, group: &AnimationGroup, speed: f32)
Play clip anim (a looping clip already playing keeps its time,
AnimationState::PlayAnimation) and set the speed to scale * speed.
Original: FUN_14010f6c0.
Sourcepub fn update(&mut self, world: &mut World<'_>, group: &AnimationGroup, dt: f32)
pub fn update(&mut self, world: &mut World<'_>, group: &AnimationGroup, dt: f32)
Run the actions, turn and move. dt is the manager’s iteration delta. Call
Character::animate first: AnimationManager::Update runs before the entity manager in
each iteration, and the move uses that step’s root motion.
Original: FUN_14010e990.
Sourcepub fn animate(&mut self, group: &AnimationGroup, dt: f32)
pub fn animate(&mut self, group: &AnimationGroup, dt: f32)
Graphics::AnimationManager::Update: advance the clip; the root delta moves the body.