VR gliding component using hand positions for flight control.
More...
#include <VrGliderComponent.h>
|
| static constexpr bool | IsUnique = true |
| static constexpr const char * | ComponentName = "VrGlider" |
| static constexpr float | CAPSULE_RADIUS = 0.3f |
| static constexpr float | CAPSULE_HALF_HEIGHT = 0.7f |
| static constexpr float | CAPSULE_TOTAL_HALF = 1.0f |
| static constexpr bool | IsUnique = false |
| | Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique = true; if needed.
|
| static constexpr const char * | ComponentName = "Logic" |
| | Fallback component type name. Derived classes may override getComponentName() for custom labels.
|
|
| HandData | getHandData (Input::Hand hand) const |
| bool | areArmsSpread (const HandData &leftHand, const HandData &rightHand, float hysteresis=0.0f) const |
| bool | areHandsTucked (const HandData &leftHand, const HandData &rightHand) const |
| void | updateGlidingVelocity (const HandData &leftHand, const HandData &rightHand, float dt) |
| ArcadeGliderTuning | makeFlightTuning () const |
| glm::vec3 | buildGlideDirection (const HandData &leftHand, const HandData &rightHand, glm::vec3 &outBodyForward, float &outForwardAmount, float &outRightAmount) const |
| glm::vec3 | getHeadWorldPosition () const |
| | Getter.
|
| glm::quat | getHeadOrientation () const |
| | Getter.
|
| glm::vec3 | getHeadForward () const |
| | Getter.
|
| bool | canStartGlidingFromWalking (const glm::vec3 ¤tPos, glm::vec3 &outTakeoffPos) const |
| bool | handleFlightCollision (const glm::vec3 ¤tPos, glm::vec3 &desiredPos) |
| bool | sweepGround (const glm::vec3 &origin, glm::vec3 &outHitPoint, glm::vec3 &outHitNormal, float &outHitFraction) const |
| void | updateWalkingInput (float dt) |
| glm::vec3 | collideAndSlide (const glm::vec3 &startPos, const glm::vec3 &displacement) |
| void | updateLastSafeLanding (const glm::vec3 &position, bool stableWalkableGround, float dt) |
| void | teleportPlayer (const glm::vec3 &position) |
| void | resetToLastSafeLanding () |
| void | resetToSpawn () |
VR gliding component using hand positions for flight control.
Definition at line 100 of file VrGliderComponent.h.
◆ VrGlider()
Constructs the VR glider component.
- Parameters
-
| owningScene | The scene this component belongs to. |
| headset | Pointer to the headset for reading head position/orientation. |
| inputHandler | Pointer to the XR input handler for hand poses. |
| physicsBody | Pointer to the physics body for applying velocities. |
◆ ~VrGlider()
| Engine::Components::VrGlider::~VrGlider |
( |
| ) |
|
|
overridedefault |
◆ areArmsSpread()
| bool Engine::Components::VrGlider::areArmsSpread |
( |
const HandData & | leftHand, |
|
|
const HandData & | rightHand, |
|
|
float | hysteresis = 0.0f ) const |
|
nodiscardprivate |
◆ areHandsTucked()
| bool Engine::Components::VrGlider::areHandsTucked |
( |
const HandData & | leftHand, |
|
|
const HandData & | rightHand ) const |
|
nodiscardprivate |
◆ beginPlay()
| void Engine::Components::VrGlider::beginPlay |
( |
| ) |
|
|
overridevirtual |
◆ buildGlideDirection()
| glm::vec3 Engine::Components::VrGlider::buildGlideDirection |
( |
const HandData & | leftHand, |
|
|
const HandData & | rightHand, |
|
|
glm::vec3 & | outBodyForward, |
|
|
float & | outForwardAmount, |
|
|
float & | outRightAmount ) const |
|
nodiscardprivate |
◆ canStartGlidingFromWalking()
| bool Engine::Components::VrGlider::canStartGlidingFromWalking |
( |
const glm::vec3 & | currentPos, |
|
|
glm::vec3 & | outTakeoffPos ) const |
|
private |
◆ collideAndSlide()
| glm::vec3 Engine::Components::VrGlider::collideAndSlide |
( |
const glm::vec3 & | startPos, |
|
|
const glm::vec3 & | displacement ) |
|
private |
◆ endPlay()
| void Engine::Components::VrGlider::endPlay |
( |
| ) |
|
|
overridevirtual |
◆ getComponentName()
| std::string Engine::Components::VrGlider::getComponentName |
( |
| ) |
const |
|
inlinenodiscardoverridevirtual |
◆ getConfig() [1/2]
◆ getConfig() [2/2]
| const GliderConfig & Engine::Components::VrGlider::getConfig |
( |
| ) |
const |
|
inlinenodiscard |
◆ getDebugSnapshot()
| const DebugSnapshot & Engine::Components::VrGlider::getDebugSnapshot |
( |
| ) |
const |
|
inlinenodiscard |
◆ getHandData()
◆ getHeadForward()
| glm::vec3 Engine::Components::VrGlider::getHeadForward |
( |
| ) |
const |
|
nodiscardprivate |
◆ getHeadOrientation()
| glm::quat Engine::Components::VrGlider::getHeadOrientation |
( |
| ) |
const |
|
nodiscardprivate |
◆ getHeadWorldPosition()
| glm::vec3 Engine::Components::VrGlider::getHeadWorldPosition |
( |
| ) |
const |
|
nodiscardprivate |
◆ getPhysicsBody()
| PhysicsBody * Engine::Components::VrGlider::getPhysicsBody |
( |
| ) |
const |
|
inlinenodiscard |
◆ getSpeed()
| float Engine::Components::VrGlider::getSpeed |
( |
| ) |
const |
|
inlinenodiscard |
◆ getState()
| GliderState Engine::Components::VrGlider::getState |
( |
| ) |
const |
|
inlinenodiscard |
◆ getVelocity()
| glm::vec3 Engine::Components::VrGlider::getVelocity |
( |
| ) |
const |
|
inlinenodiscard |
◆ handleFlightCollision()
| bool Engine::Components::VrGlider::handleFlightCollision |
( |
const glm::vec3 & | currentPos, |
|
|
glm::vec3 & | desiredPos ) |
|
private |
◆ isDebugLogging()
| bool Engine::Components::VrGlider::isDebugLogging |
( |
| ) |
const |
|
inlinenodiscard |
◆ isEnabled()
| bool Engine::Components::VrGlider::isEnabled |
( |
| ) |
const |
|
inlinenodiscard |
◆ isFrozen()
| bool Engine::Components::VrGlider::isFrozen |
( |
| ) |
const |
|
inlinenodiscard |
◆ makeFlightTuning()
◆ resetGliderStateTo()
| void Engine::Components::VrGlider::resetGliderStateTo |
( |
GliderState | state | ) |
|
◆ resetToLastSafeLanding()
| void Engine::Components::VrGlider::resetToLastSafeLanding |
( |
| ) |
|
|
private |
◆ resetToSpawn()
| void Engine::Components::VrGlider::resetToSpawn |
( |
| ) |
|
|
private |
◆ setConfig()
| void Engine::Components::VrGlider::setConfig |
( |
const GliderConfig & | config | ) |
|
|
inline |
◆ setDebugLogging()
| void Engine::Components::VrGlider::setDebugLogging |
( |
bool | enabled | ) |
|
|
inline |
◆ setEnabled()
| void Engine::Components::VrGlider::setEnabled |
( |
bool | enabled | ) |
|
|
inline |
◆ setFrozen()
| void Engine::Components::VrGlider::setFrozen |
( |
bool | frozen | ) |
|
Pauses/unpauses physics integration.
◆ stateToString()
| const char * Engine::Components::VrGlider::stateToString |
( |
GliderState | state | ) |
|
|
staticnodiscard |
Returns string representation of a glider state.
◆ sweepGround()
| bool Engine::Components::VrGlider::sweepGround |
( |
const glm::vec3 & | origin, |
|
|
glm::vec3 & | outHitPoint, |
|
|
glm::vec3 & | outHitNormal, |
|
|
float & | outHitFraction ) const |
|
private |
◆ teleportPlayer()
| void Engine::Components::VrGlider::teleportPlayer |
( |
const glm::vec3 & | position | ) |
|
|
private |
◆ tick()
| void Engine::Components::VrGlider::tick |
( |
double | deltaTime | ) |
|
|
overridevirtual |
Called every frame if ticking is enabled.
- Parameters
-
| deltaTime | Time elapsed since last frame. |
Reimplemented from Engine::Components::Logic.
◆ updateGlidingVelocity()
| void Engine::Components::VrGlider::updateGlidingVelocity |
( |
const HandData & | leftHand, |
|
|
const HandData & | rightHand, |
|
|
float | dt ) |
|
private |
◆ updateLastSafeLanding()
| void Engine::Components::VrGlider::updateLastSafeLanding |
( |
const glm::vec3 & | position, |
|
|
bool | stableWalkableGround, |
|
|
float | dt ) |
|
private |
◆ updateWalkingInput()
| void Engine::Components::VrGlider::updateWalkingInput |
( |
float | dt | ) |
|
|
private |
◆ bothGripsWerePressed_
| bool Engine::Components::VrGlider::bothGripsWerePressed_ = false |
|
private |
◆ CAPSULE_HALF_HEIGHT
| float Engine::Components::VrGlider::CAPSULE_HALF_HEIGHT = 0.7f |
|
staticconstexpr |
◆ CAPSULE_RADIUS
| float Engine::Components::VrGlider::CAPSULE_RADIUS = 0.3f |
|
staticconstexpr |
◆ CAPSULE_TOTAL_HALF
| float Engine::Components::VrGlider::CAPSULE_TOTAL_HALF = 1.0f |
|
staticconstexpr |
◆ ComponentName
| const char* Engine::Components::VrGlider::ComponentName = "VrGlider" |
|
staticconstexpr |
◆ config_
◆ currentState_
◆ DEBUG_LOG_INTERVAL
| float Engine::Components::VrGlider::DEBUG_LOG_INTERVAL = 0.5f |
|
staticconstexprprivate |
◆ debugLogging_
| bool Engine::Components::VrGlider::debugLogging_ = true |
|
private |
◆ debugLogTimer_
| float Engine::Components::VrGlider::debugLogTimer_ = 0.0f |
|
private |
◆ debugSnapshot_
◆ enabled_
| bool Engine::Components::VrGlider::enabled_ = true |
|
private |
◆ flightState_
◆ frozen_
| bool Engine::Components::VrGlider::frozen_ = true |
|
private |
◆ GRIP_THRESHOLD
| float Engine::Components::VrGlider::GRIP_THRESHOLD = 0.8f |
|
staticconstexprprivate |
◆ groundYInitialized_
| bool Engine::Components::VrGlider::groundYInitialized_ = false |
|
private |
◆ hasLastSafeLandingPosition_
| bool Engine::Components::VrGlider::hasLastSafeLandingPosition_ = false |
|
private |
◆ headset_
◆ inputHandler_
◆ IsUnique
| bool Engine::Components::VrGlider::IsUnique = true |
|
staticconstexpr |
◆ landingCheckpointTimer_
| float Engine::Components::VrGlider::landingCheckpointTimer_ = 0.0f |
|
private |
◆ lastSafeLandingPosition_
| glm::vec3 Engine::Components::VrGlider::lastSafeLandingPosition_ { 0.0f, 10.0f, 0.0f } |
|
private |
◆ lastWindSample_
◆ MAX_SLIDE_ITERATIONS
| int Engine::Components::VrGlider::MAX_SLIDE_ITERATIONS = 3 |
|
staticconstexprprivate |
◆ physicsBody_
| PhysicsBody* Engine::Components::VrGlider::physicsBody_ = nullptr |
|
private |
◆ playerYaw_
| float Engine::Components::VrGlider::playerYaw_ = 0.0f |
|
private |
◆ rightStickSnapTurnArmed_
| bool Engine::Components::VrGlider::rightStickSnapTurnArmed_ = true |
|
private |
◆ SKIN_WIDTH
| float Engine::Components::VrGlider::SKIN_WIDTH = 0.02f |
|
staticconstexprprivate |
◆ smoothedGroundY_
| float Engine::Components::VrGlider::smoothedGroundY_ = 0.0f |
|
private |
◆ takeoffArmed_
| bool Engine::Components::VrGlider::takeoffArmed_ = true |
|
private |
◆ velocity_
| glm::vec3 Engine::Components::VrGlider::velocity_ { 0.0f } |
|
private |
The documentation for this class was generated from the following file: