载入中...
搜索中...
未找到
eve::animation::PhysicalBalancePose类 参考

Authored-pose overlay that wobbles from world impulses and recovers balance. 更多...

#include <PhysicalBalancePose.h>

Public 成员函数

 PhysicalBalancePose (AnimSkeleton *skeleton)
 Construct for a borrowed skeleton.
 
 ~PhysicalBalancePose ()=default
 Physical balance pose.
 
 PhysicalBalancePose (const PhysicalBalancePose &)=delete
 
PhysicalBalancePose & operator= (const PhysicalBalancePose &)=delete
 
AnimSkeleton * getSkeleton () const
 Borrowed skeleton. @ownership Borrowed; ownership remains with the animation source. @lifetime Valid until this object or the skeleton is destroyed.
 
eve::Result< void > setSupportBone (int boneIndex)
 Bone whose world XZ is the support point (typically pelvis/root).
 
int getSupportBone () const
 
eve::Result< void > setBalanceBone (int boneIndex)
 Bone that receives whole-body lean (typically spine/chest).
 
int getBalanceBone () const
 
eve::Result< void > setBoneMass (int boneIndex, float mass)
 Mass used for center-of-mass; zero excludes the bone.
 
float getBoneMass (int boneIndex) const
 
eve::Result< void > setRecovery (float frequencyHz, float dampingZeta)
 Recovery frequency (Hz) and damping ζ for the balance pendulum.
 
float getRecoveryFrequency () const
 
float getRecoveryDamping () const
 
eve::Result< void > setRecoil (float frequencyHz, float dampingZeta)
 Local-bone recoil frequency and damping toward the authored rotation.
 
float getRecoilFrequency () const
 
float getRecoilDamping () const
 
eve::Result< void > setGravity (float metersPerSecondSquared)
 Gravity magnitude (m/s², Y-up). Zero disables the fall-away term.
 
float getGravity () const
 
eve::Result< void > setPendulumHeight (float meters)
 Pendulum length used as g/h (meters).
 
float getPendulumHeight () const
 
eve::Result< void > setInertia (float inertia)
 Whole-body rotational inertia for lean (kg·m²).
 
float getInertia () const
 
eve::Result< void > setRecoilInertia (float inertia)
 Per-bone recoil inertia (kg·m²).
 
float getRecoilInertia () const
 
eve::Result< void > setMaxLean (float radians)
 Clamp for lean angle in radians.
 
float getMaxLean () const
 
eve::Result< void > setTargetPose (const AnimPose *target)
 Copy the authored pose that recovery tracks.
 
eve::Result< void > snapToTarget ()
 Zero lean, recoil and pending impulses; pose snaps to the last target.
 
eve::Result< void > applyImpulse (int boneIndex, float impulseX, float impulseY, float impulseZ, float pointX, float pointY, float pointZ)
 Queue a world-space linear impulse at a world point.
 
eve::Result< void > advance (const eve::SimulationStep &step)
 Advance the pendulum and recoil, then write the overlay pose.
 
void update (float dt)
 Legacy seconds facade; forwards to advance() and ignores its Result.
 
AnimPose * getPose ()
 Overlay pose after the last successful advance (or snap). @ownership Borrowed; this object retains ownership. @lifetime Valid until the next mutating call or destruction.
 
AnimPose * getTargetPose ()
 Last authored target, or bind pose before the first setTargetPose. @ownership Borrowed; this object retains ownership. @lifetime Valid until the next setTargetPose/snap or destruction.
 
float getLeanX () const
 
float getLeanZ () const
 
float getLeanVelocityX () const
 
float getLeanVelocityZ () const
 
float getCenterOfMassX () const
 
float getCenterOfMassY () const
 
float getCenterOfMassZ () const
 
float getSupportX () const
 
float getSupportY () const
 
float getSupportZ () const
 

详细描述

Authored-pose overlay that wobbles from world impulses and recovers balance.

Animation remains the target. A planar inverted pendulum on the balance bone leans from contact impulses; recovery PD plus a gravity term makes the character actively fight the lean. Optional per-bone recoil springs back to the authored local rotation. Physics is not referenced: callers inject impulse values from World3D contacts or gameplay.

Determinism: identical skeleton, target pose, impulses and SimulationStep sequences produce the same pose within float rounding. Not bit-exact across compilers.

Script type: PhysicalBalancePose. @ownership Value-like runtime object; the borrowed skeleton is not owned. @thread Owner thread only; no callbacks or reentrancy.

在文件 PhysicalBalancePose.h 第 30 行定义.

构造及析构函数说明

◆ PhysicalBalancePose() [1/2]

eve::animation::PhysicalBalancePose::PhysicalBalancePose ( AnimSkeleton *  skeleton)
explicit

Construct for a borrowed skeleton.

参数
skeletonHierarchy used for world COM and bone indexing; must outlive this object.
异常
eve::Exceptionwhen skeleton is null.

在文件 PhysicalBalancePose.cpp 第 52 行定义.

引用了 eve::animation::AnimSkeleton::applyBindPose().

◆ ~PhysicalBalancePose()

eve::animation::PhysicalBalancePose::~PhysicalBalancePose ( )
default

Physical balance pose.

◆ PhysicalBalancePose() [2/2]

eve::animation::PhysicalBalancePose::PhysicalBalancePose ( const PhysicalBalancePose &  )
delete

成员函数说明

◆ advance()

eve::Result< void > eve::animation::PhysicalBalancePose::advance ( const eve::SimulationStep &  step)

Advance the pendulum and recoil, then write the overlay pose.

返回
Applied, or InvalidArgument/Conflict for a bad step.

在文件 PhysicalBalancePose.cpp 第 355 行定义.

引用了 eve::Applied, eve::Result< T >::failure(), eve::animation::detail::secondsForStep(), step, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 update().

◆ applyImpulse()

eve::Result< void > eve::animation::PhysicalBalancePose::applyImpulse ( int  boneIndex,
float  impulseX,
float  impulseY,
float  impulseZ,
float  pointX,
float  pointY,
float  pointZ 
)

Queue a world-space linear impulse at a world point.

Torque about the support updates lean velocity; torque about the hit bone updates that bone's recoil. Applied on the next advance.

参数
boneIndexHit bone; must be in range.
返回
Applied, NoOp for a near-zero impulse, or InvalidArgument for bad input.

在文件 PhysicalBalancePose.cpp 第 225 行定义.

引用了 eve::Applied, bone, eve::animation::AnimPose::computeWorld(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::NoOp, eve::animation::TransformTRS::px, eve::animation::TransformTRS::py, eve::animation::TransformTRS::pz, eve::Status::success(), eve::Result< T >::success() , 以及 eve::animation::AnimPose::world().

◆ getBalanceBone()

int eve::animation::PhysicalBalancePose::getBalanceBone ( ) const

在文件 PhysicalBalancePose.cpp 第 378 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getBoneMass()

float eve::animation::PhysicalBalancePose::getBoneMass ( int  boneIndex) const

在文件 PhysicalBalancePose.cpp 第 116 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getCenterOfMassX()

float eve::animation::PhysicalBalancePose::getCenterOfMassX ( ) const

在文件 PhysicalBalancePose.cpp 第 392 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getCenterOfMassY()

float eve::animation::PhysicalBalancePose::getCenterOfMassY ( ) const

在文件 PhysicalBalancePose.cpp 第 393 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getCenterOfMassZ()

float eve::animation::PhysicalBalancePose::getCenterOfMassZ ( ) const

在文件 PhysicalBalancePose.cpp 第 394 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getGravity()

float eve::animation::PhysicalBalancePose::getGravity ( ) const

在文件 PhysicalBalancePose.cpp 第 383 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getInertia()

float eve::animation::PhysicalBalancePose::getInertia ( ) const

在文件 PhysicalBalancePose.cpp 第 385 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getLeanVelocityX()

float eve::animation::PhysicalBalancePose::getLeanVelocityX ( ) const

在文件 PhysicalBalancePose.cpp 第 390 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getLeanVelocityZ()

float eve::animation::PhysicalBalancePose::getLeanVelocityZ ( ) const

在文件 PhysicalBalancePose.cpp 第 391 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getLeanX()

float eve::animation::PhysicalBalancePose::getLeanX ( ) const

在文件 PhysicalBalancePose.cpp 第 388 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getLeanZ()

float eve::animation::PhysicalBalancePose::getLeanZ ( ) const

在文件 PhysicalBalancePose.cpp 第 389 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getMaxLean()

float eve::animation::PhysicalBalancePose::getMaxLean ( ) const

在文件 PhysicalBalancePose.cpp 第 387 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getPendulumHeight()

float eve::animation::PhysicalBalancePose::getPendulumHeight ( ) const

在文件 PhysicalBalancePose.cpp 第 384 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getPose()

AnimPose * eve::animation::PhysicalBalancePose::getPose ( )

Overlay pose after the last successful advance (or snap). @ownership Borrowed; this object retains ownership. @lifetime Valid until the next mutating call or destruction.

在文件 PhysicalBalancePose.cpp 第 373 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getRecoilDamping()

float eve::animation::PhysicalBalancePose::getRecoilDamping ( ) const

在文件 PhysicalBalancePose.cpp 第 382 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getRecoilFrequency()

float eve::animation::PhysicalBalancePose::getRecoilFrequency ( ) const

在文件 PhysicalBalancePose.cpp 第 381 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getRecoilInertia()

float eve::animation::PhysicalBalancePose::getRecoilInertia ( ) const

在文件 PhysicalBalancePose.cpp 第 386 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getRecoveryDamping()

float eve::animation::PhysicalBalancePose::getRecoveryDamping ( ) const

在文件 PhysicalBalancePose.cpp 第 380 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getRecoveryFrequency()

float eve::animation::PhysicalBalancePose::getRecoveryFrequency ( ) const

在文件 PhysicalBalancePose.cpp 第 379 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getSkeleton()

AnimSkeleton * eve::animation::PhysicalBalancePose::getSkeleton ( ) const

Borrowed skeleton. @ownership Borrowed; ownership remains with the animation source. @lifetime Valid until this object or the skeleton is destroyed.

在文件 PhysicalBalancePose.cpp 第 376 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getSupportBone()

int eve::animation::PhysicalBalancePose::getSupportBone ( ) const

在文件 PhysicalBalancePose.cpp 第 377 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getSupportX()

float eve::animation::PhysicalBalancePose::getSupportX ( ) const

在文件 PhysicalBalancePose.cpp 第 395 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getSupportY()

float eve::animation::PhysicalBalancePose::getSupportY ( ) const

在文件 PhysicalBalancePose.cpp 第 396 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getSupportZ()

float eve::animation::PhysicalBalancePose::getSupportZ ( ) const

在文件 PhysicalBalancePose.cpp 第 397 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ getTargetPose()

AnimPose * eve::animation::PhysicalBalancePose::getTargetPose ( )

Last authored target, or bind pose before the first setTargetPose. @ownership Borrowed; this object retains ownership. @lifetime Valid until the next setTargetPose/snap or destruction.

在文件 PhysicalBalancePose.cpp 第 374 行定义.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().

◆ operator=()

PhysicalBalancePose & eve::animation::PhysicalBalancePose::operator= ( const PhysicalBalancePose &  )
delete

◆ setBalanceBone()

eve::Result< void > eve::animation::PhysicalBalancePose::setBalanceBone ( int  boneIndex)

Bone that receives whole-body lean (typically spine/chest).

返回
Applied, or InvalidArgument when the index is out of range.

在文件 PhysicalBalancePose.cpp 第 98 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setBoneMass()

eve::Result< void > eve::animation::PhysicalBalancePose::setBoneMass ( int  boneIndex,
float  mass 
)

Mass used for center-of-mass; zero excludes the bone.

返回
Applied, InvalidArgument for a bad index or non-finite/negative mass.

在文件 PhysicalBalancePose.cpp 第 106 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, ok, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setGravity()

eve::Result< void > eve::animation::PhysicalBalancePose::setGravity ( float  metersPerSecondSquared)

Gravity magnitude (m/s², Y-up). Zero disables the fall-away term.

在文件 PhysicalBalancePose.cpp 第 149 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), height, eve::InvalidArgument, ok, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setInertia()

eve::Result< void > eve::animation::PhysicalBalancePose::setInertia ( float  inertia)

Whole-body rotational inertia for lean (kg·m²).

在文件 PhysicalBalancePose.cpp 第 174 行定义.

引用了 eve::Applied, inertia, ok, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setMaxLean()

eve::Result< void > eve::animation::PhysicalBalancePose::setMaxLean ( float  radians)

Clamp for lean angle in radians.

在文件 PhysicalBalancePose.cpp 第 188 行定义.

引用了 eve::Applied, eve::animation::clampf(), ok, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setPendulumHeight()

eve::Result< void > eve::animation::PhysicalBalancePose::setPendulumHeight ( float  meters)

◆ setRecoil()

eve::Result< void > eve::animation::PhysicalBalancePose::setRecoil ( float  frequencyHz,
float  dampingZeta 
)

Local-bone recoil frequency and damping toward the authored rotation.

在文件 PhysicalBalancePose.cpp 第 138 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setRecoilInertia()

eve::Result< void > eve::animation::PhysicalBalancePose::setRecoilInertia ( float  inertia)

Per-bone recoil inertia (kg·m²).

在文件 PhysicalBalancePose.cpp 第 181 行定义.

引用了 eve::Applied, inertia, ok, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setRecovery()

eve::Result< void > eve::animation::PhysicalBalancePose::setRecovery ( float  frequencyHz,
float  dampingZeta 
)

Recovery frequency (Hz) and damping ζ for the balance pendulum.

Requires (2π f)² > g / height so the character can win against gravity. ζ in (0, 1) wobbles while returning upright; ζ ≥ 1 settles without overshoot.

在文件 PhysicalBalancePose.cpp 第 121 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), height, eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setSupportBone()

eve::Result< void > eve::animation::PhysicalBalancePose::setSupportBone ( int  boneIndex)

Bone whose world XZ is the support point (typically pelvis/root).

返回
Applied, or InvalidArgument when the index is out of range.

在文件 PhysicalBalancePose.cpp 第 90 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setTargetPose()

eve::Result< void > eve::animation::PhysicalBalancePose::setTargetPose ( const AnimPose *  target)

Copy the authored pose that recovery tracks.

参数
targetBorrowed for this call only; bone count must match the skeleton.
返回
Applied, or InvalidArgument when target is null or the count mismatches.

在文件 PhysicalBalancePose.cpp 第 197 行定义.

引用了 eve::Applied, eve::animation::AnimPose::copyFrom(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::animation::AnimSkeleton::getBoneCount(), eve::InvalidArgument, eve::Status::success(), eve::Result< T >::success() , 以及 target.

◆ snapToTarget()

eve::Result< void > eve::animation::PhysicalBalancePose::snapToTarget ( )

Zero lean, recoil and pending impulses; pose snaps to the last target.

在文件 PhysicalBalancePose.cpp 第 216 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Status::success() , 以及 eve::Result< T >::success().

◆ update()

void eve::animation::PhysicalBalancePose::update ( float  dt)

Legacy seconds facade; forwards to advance() and ignores its Result.

在文件 PhysicalBalancePose.cpp 第 364 行定义.

引用了 advance(), eve::Result< void >::ignore(), eve::animation::detail::legacyStep() , 以及 step.

被这些函数引用 eve::animation::exposePhysicalBalancePoseBindings().


该类的文档由以下文件生成: