7#include <glm/gtc/quaternion.hpp>
232 void tick(
double deltaTime )
override;
360 float hysteresis = 0.0f
372 glm::vec3 & outBodyForward,
373 float & outForwardAmount,
374 float & outRightAmount
397 const glm::vec3 & origin,
398 glm::vec3 & outHitPoint,
399 glm::vec3 & outHitNormal,
400 float & outHitFraction
405 glm::vec3
collideAndSlide(
const glm::vec3 & startPos,
const glm::vec3 & displacement );
Logic(Entities::Scene *owningScene)
Component that manages a physics rigid body for an entity.
bool areArmsSpread(const HandData &leftHand, const HandData &rightHand, float hysteresis=0.0f) const
glm::vec3 lastSafeLandingPosition_
static constexpr float DEBUG_LOG_INTERVAL
glm::vec3 collideAndSlide(const glm::vec3 &startPos, const glm::vec3 &displacement)
void resetGliderStateTo(GliderState state)
static constexpr float GRIP_THRESHOLD
void updateWalkingInput(float dt)
void tick(double deltaTime) override
Called every frame if ticking is enabled.
void beginPlay() override
Called when the component is added to the scene or the game starts.
glm::vec3 getHeadForward() const
Getter.
const GliderConfig & getConfig() const
Getter.
bool sweepGround(const glm::vec3 &origin, glm::vec3 &outHitPoint, glm::vec3 &outHitNormal, float &outHitFraction) const
PhysicsBody * physicsBody_
bool handleFlightCollision(const glm::vec3 ¤tPos, glm::vec3 &desiredPos)
glm::vec3 buildGlideDirection(const HandData &leftHand, const HandData &rightHand, glm::vec3 &outBodyForward, float &outForwardAmount, float &outRightAmount) const
bool isEnabled() const
Getter.
glm::vec3 getHeadWorldPosition() const
Getter.
Rendering::Headset * headset_
bool isFrozen() const
Getter.
bool rightStickSnapTurnArmed_
static constexpr float CAPSULE_TOTAL_HALF
float getSpeed() const
Getter.
static constexpr int MAX_SLIDE_ITERATIONS
static constexpr float SKIN_WIDTH
static constexpr bool IsUnique
GliderState currentState_
GliderState getState() const
Getter.
std::string getComponentName() const override
Gets the component type name for debugging/UI.
void setDebugLogging(bool enabled)
Setter.
bool isDebugLogging() const
Getter.
ArcadeGliderState flightState_
static const char * stateToString(GliderState state)
Returns string representation of a glider state.
bool hasLastSafeLandingPosition_
PhysicsBody * getPhysicsBody() const
void updateLastSafeLanding(const glm::vec3 &position, bool stableWalkableGround, float dt)
Input::XrInputHandler * inputHandler_
bool areHandsTucked(const HandData &leftHand, const HandData &rightHand) const
void setConfig(const GliderConfig &config)
Setter.
const DebugSnapshot & getDebugSnapshot() const
void endPlay() override
Called when the component is removed or the game ends.
void setFrozen(bool frozen)
Pauses/unpauses physics integration.
void resetToLastSafeLanding()
void updateGlidingVelocity(const HandData &leftHand, const HandData &rightHand, float dt)
HandData getHandData(Input::Hand hand) const
World::WindSample lastWindSample_
static constexpr const char * ComponentName
glm::vec3 getVelocity() const
Getter.
static constexpr float CAPSULE_HALF_HEIGHT
void setEnabled(bool enabled)
Setter.
void teleportPlayer(const glm::vec3 &position)
VrGlider(Entities::Scene *owningScene, Rendering::Headset *headset, Input::XrInputHandler *inputHandler, PhysicsBody *physicsBody)
Constructs the VR glider component.
DebugSnapshot debugSnapshot_
static constexpr float CAPSULE_RADIUS
~VrGlider() override=default
float landingCheckpointTimer_
bool canStartGlidingFromWalking(const glm::vec3 ¤tPos, glm::vec3 &outTakeoffPos) const
ArcadeGliderTuning makeFlightTuning() const
glm::quat getHeadOrientation() const
Getter.
bool bothGripsWerePressed_
GliderConfig & getConfig()
Getter.
A scene is the overarching structure which can spawn, contain and destroy actors or entities.
GliderState
Glider movement states.
Stores the config values for the glider. Can be used to change the flight behavior of the glider move...
float landingCheckpointTimer
glm::vec3 headWorldPosition
glm::vec3 groundHitNormal
GliderState previousState
glm::vec3 takeoffTestPosition
glm::vec3 velocityAfterUpdate
float rightHandCylinderDistance
World::WindSample windSample
glm::vec2 rightThumbstick
glm::vec3 collisionPushOut
float collisionMaxPenetration
bool armsSpreadWithHysteresis
float leftHandCylinderDistance
glm::vec3 velocityBeforeUpdate
glm::vec3 collisionTestPosition
float capsuleCylinderHeight
glm::vec3 headLocalPosition
bool bothGripsWerePressed
glm::vec3 windContribution
glm::vec3 collisionGroundNormal
glm::vec3 physicsBodyVelocity
glm::vec3 desiredPosition
glm::vec3 lastSafeLandingPosition
Hand position and orientation data relative to head.
glm::vec3 relativePosition
glm::vec3 fingerDirection
Configuration parameters for the VR glider system (distances in meters, speeds in m/s,...
float respawnHeightOffset
float walkTakeoffMomentum
float fallingTerminalVelocity
float armSpreadHysteresis
float flightCollisionFallSpeed
float walkTakeoffLiftSpeed
float landingCheckpointSettleTime
float minArmSpreadDistance
float walkTakeoffClearance
float windDiminishingSpeed
A wind sample is the wind force at one point in the wind field.