Skip to main content

YawPitchRollUpdateSystem Class Template

Updates Rotation3DComponent<..., Local> from YawPitchRollComponent. More...

Declaration

template <typename TMemberHandle> class helios::engine::scene::systems::YawPitchRollUpdateSystem<TMemberHandle> { ... }

Public Member Typedefs Index

template <typename TMemberHandle>
usingEngineRoleTag = TypedSystemRole

Runtime role tag used for system registration. More...

Public Member Functions Index

template <typename TMemberHandle>
voidupdate (UpdateContext &updateContext) noexcept

Executes one update pass for active entities. More...

Private Member Functions Index

template <typename TMemberHandle>
floatwrapRad (float a) const noexcept

Wraps an angle to the interval [-pi, +pi]. More...

Description

Updates Rotation3DComponent<..., Local> from YawPitchRollComponent.

Template Parameters
TMemberHandle

ECS member handle type used by queried components.

Definition at line 36 of file YawPitchRollUpdateSystem.ixx.

Public Member Typedefs

EngineRoleTag

template <typename TMemberHandle>
using helios::engine::scene::systems::YawPitchRollUpdateSystem< TMemberHandle >::EngineRoleTag = TypedSystemRole

Runtime role tag used for system registration.

Definition at line 55 of file YawPitchRollUpdateSystem.ixx.

Public Member Functions

update()

template <typename TMemberHandle>
void helios::engine::scene::systems::YawPitchRollUpdateSystem< TMemberHandle >::update (UpdateContext & updateContext)
inline noexcept

Executes one update pass for active entities.

Reads yaw/pitch/roll angles, wraps them to [-pi, +pi], builds axis-angle quaternions and writes the composed local rotation.

Parameters
updateContext

Frame-local update context with ECS access.

Definition at line 65 of file YawPitchRollUpdateSystem.ixx.

66
67
68 for (auto [entity, yawPitchRoll, localRotation, active] : updateContext.view<
73 >().whereEnabled()) {
74 constexpr auto x = helios::math::X_AXISf;
75 constexpr auto y = helios::math::Y_AXISf;
76 constexpr auto z = helios::math::Z_AXISf;
77
78 const auto yaw = wrapRad(yawPitchRoll->yaw);
79 const auto pitch = wrapRad(yawPitchRoll->pitch);
80 const auto roll = wrapRad(yawPitchRoll->roll);
81
82 const auto qYaw = helios::math::quatf::fromAxisAngle(y, yaw);
83 const auto qPitch = helios::math::quatf::fromAxisAngle(x, pitch);
84 const auto qRoll = helios::math::quatf::fromAxisAngle(z, roll);
85
86 localRotation->setValue(qYaw * qPitch * qRoll);
87
88 }
89
90 }

Reference helios::engine::scene::registerComponents.

Private Member Functions

wrapRad()

template <typename TMemberHandle>
float helios::engine::scene::systems::YawPitchRollUpdateSystem< TMemberHandle >::wrapRad (float a)
inline noexcept

Wraps an angle to the interval [-pi, +pi].

Parameters
a

Input angle in radians.

Returns

Wrapped angle in radians.

Definition at line 44 of file YawPitchRollUpdateSystem.ixx.

44 [[nodiscard]] float wrapRad(float a) const noexcept {
45 constexpr float pi = std::numbers::pi_v<float>;
46 constexpr float twoPi = 2.0f * pi;
47 return std::fmod(std::fmod(a + pi, twoPi) + twoPi, twoPi) - pi;
48 }

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.