Torque3D Documentation / _generateds / VHumanoidPhysicsStates.cpp

VHumanoidPhysicsStates.cpp

Engine/source/Verve/VActor/Humanoid/VHumanoidPhysicsStates.cpp

More...

Detailed Description

Public Functions

ExecuteActorPhysicsState(HumanoidInAir )

ExecuteActorPhysicsState(HumanoidInWater )

ExecuteActorPhysicsState(HumanoidOnGround )

ImplementActorPhysicsState(HumanoidInAir , VHumanoidActorData::k_InAirPhysics )

ImplementActorPhysicsState(HumanoidInWater , VHumanoidActorData::k_InWaterPhysics )

ImplementActorPhysicsState(HumanoidOnGround , VHumanoidActorData::k_OnGroundPhysics )

ProcessActorPhysicsState(HumanoidInAir )

ProcessActorPhysicsState(HumanoidInWater )

ProcessActorPhysicsState(HumanoidOnGround )

  1
  2//-----------------------------------------------------------------------------
  3// Verve
  4// Copyright (C) 2014 - Violent Tulip
  5//
  6// Permission is hereby granted, free of charge, to any person obtaining a copy
  7// of this software and associated documentation files (the "Software"), to
  8// deal in the Software without restriction, including without limitation the
  9// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10// sell copies of the Software, and to permit persons to whom the Software is
 11// furnished to do so, subject to the following conditions:
 12//
 13// The above copyright notice and this permission notice shall be included in
 14// all copies or substantial portions of the Software.
 15//
 16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 22// IN THE SOFTWARE.
 23//-----------------------------------------------------------------------------
 24#include "VHumanoidPhysicsStates.h"
 25#include "VHumanoidActor.h"
 26
 27#include "../VActorPhysicsController.h"
 28
 29//-----------------------------------------------------------------------------
 30//
 31// Implement Physics States.
 32//
 33//-----------------------------------------------------------------------------
 34
 35ImplementActorPhysicsState( HumanoidOnGround, VHumanoidActorData::k_OnGroundPhysics );
 36ImplementActorPhysicsState( HumanoidInAir,    VHumanoidActorData::k_InAirPhysics );
 37ImplementActorPhysicsState( HumanoidInWater,  VHumanoidActorData::k_InWaterPhysics );
 38
 39
 40
 41
 42//-----------------------------------------------------------------------------
 43//
 44// Execute Animation States.
 45//
 46//-----------------------------------------------------------------------------
 47
 48ExecuteActorPhysicsState( HumanoidOnGround )
 49{
 50    // Fetch Controller.
 51    VActorPhysicsController *physicsController = pObject->getPhysicsController();
 52
 53    // On the Ground?
 54    if ( !physicsController->isOnGround() )
 55    {
 56        // No.
 57        return false;
 58    }
 59
 60    // On Ground.
 61    return true;
 62}
 63
 64ProcessActorPhysicsState( HumanoidOnGround )
 65{
 66    // Void.
 67}
 68
 69//-----------------------------------------------------------------------------
 70
 71ExecuteActorPhysicsState( HumanoidInAir )
 72{
 73    // Fetch Controller.
 74    VActorPhysicsController *physicsController = pObject->getPhysicsController();
 75
 76    // In the Air?
 77    if ( !physicsController->isInAir() )
 78    {
 79        // No.
 80        return false;
 81    }
 82
 83    // In Air.
 84    return true;
 85}
 86
 87ProcessActorPhysicsState( HumanoidInAir )
 88{
 89    // Apply Gravity for the Tick.
 90    pObject->getPhysicsController()->applyGravity( pElapsedTime );
 91}
 92
 93//-----------------------------------------------------------------------------
 94
 95ExecuteActorPhysicsState( HumanoidInWater )
 96{
 97    // Fetch Controller.
 98    VActorPhysicsController *physicsController = pObject->getPhysicsController();
 99
100    // Sumberged?
101    if ( !physicsController->isInWater() )
102    {
103        // No.
104        return false;
105    }
106
107    // Swimming
108    return true;
109}
110
111ProcessActorPhysicsState( HumanoidInWater )
112{
113    // Void.
114}
115