YawPitchRollUpdateSystem.ixx File
System that converts yaw/pitch/roll angles to local rotation quaternions. More...
Included Headers
#include <cmath>
#include <numbers>
#include <helios.engine.core.types.ComponentTypeTags>
#include <helios.math>
#include <helios.engine.spatial.components>
#include <helios.ecs.components>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.runtime.world.tags.SystemRole>
Namespaces Index
| namespace | helios |
| namespace | engine |
| namespace | scene |
| namespace | systems |
Classes Index
| class | YawPitchRollUpdateSystem<TMemberHandle> |
|
Updates Rotation3DComponent<..., Local> from YawPitchRollComponent. More... | |
Description
System that converts yaw/pitch/roll angles to local rotation quaternions.
File Listing
The file content with the documentation metadata removed is:
23using namespace helios::engine::core::types;
25using namespace helios::engine::spatial::components;
26using namespace helios::engine::runtime::world;
27using namespace helios::engine::runtime::world::tags;
28export namespace helios::engine::scene::systems {
36 class YawPitchRollUpdateSystem {
44 [[nodiscard]] float wrapRad(float a) const noexcept {
45 constexpr float pi = std::numbers::pi_v<float>;
55 using EngineRoleTag = TypedSystemRole;
65 void update(UpdateContext& updateContext) noexcept {
68 for (auto [entity, yawPitchRoll, localRotation, active] : updateContext.view<
69 TMemberHandle,
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;
78 const auto yaw = wrapRad(yawPitchRoll->yaw);
79 const auto pitch = wrapRad(yawPitchRoll->pitch);
80 const auto roll = wrapRad(yawPitchRoll->roll);
86 localRotation->setValue(qYaw * qPitch * qRoll);
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.