blob: d069c7d7f367e44a7e4d8f1861874b879ab29b26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#pragma once
#include "Runtime/BaseClasses/GameObject.h"
#include "Collider.h"
#include "Runtime/Math/Vector3.h"
#include "Runtime/Math/Vector2.h"
class NxCapsuleController;
struct MonoObject;
struct RootMotionData;
class CharacterController : public Collider
{
public:
REGISTER_DERIVED_CLASS(CharacterController, Collider)
DECLARE_OBJECT_SERIALIZE(CharacterController)
virtual void AwakeFromLoad(AwakeFromLoadMode mode);
CharacterController (MemLabelId label, ObjectCreationMode mode);
virtual void Reset();
virtual void SmartReset ();
int Move (const Vector3f& movement);
Vector2f GetGlobalExtents () const;
virtual void TransformChanged(int mask);
void SetRadius(float radius);
float GetRadius() { return m_Radius; }
void SetHeight(float height);
float GetHeight() { return m_Height; }
virtual AABB GetBounds ();
Vector3f GetCenter ();
void SetCenter(const Vector3f& center);
float GetSlopeLimit ();
void SetSlopeLimit (float limit);
float GetStepOffset ();
void SetStepOffset (float limit);
virtual void SetIsTrigger (bool trigger);
static void CreateControllerManager ();
static void CleanupControllerManager ();
Vector3f GetWorldCenterPosition() const;
bool SimpleMove (const Vector3f& movement);
// bool SimpleJump (const Vector3f& movement, float jumpHeight);
Vector3f GetVelocity();
bool IsGrounded ();
int GetCollisionFlags() { return m_LastCollisionFlags; }
bool GetDetectCollisions () { return m_DetectCollision; }
void SetDetectCollisions (bool detect);
static void InitializeClass ();
static void CleanupClass ();
private:
virtual void Create(const Rigidbody* ignoreAttachRigidbody);
virtual void Cleanup();
virtual void ScaleChanged ();
void ApplyRootMotionBuiltin (RootMotionData* rootMotion);
NxCapsuleController* m_Controller;
float m_MinMoveDistance;///< range { 0, infinity }
float m_SkinWidth;///< range { 0.0001, infinity }
float m_SlopeLimit;///< range { 0, 180 }
float m_StepOffset;///< range { 0, infinity }
float m_Height;///< range { 0, infinity }
float m_Radius;///< range { 0, infinity }
Vector3f m_Center;
bool m_DetectCollision;
float m_VerticalSpeed;
Vector3f m_Velocity;
Vector3f m_LastSimpleVelocity;
int m_LastCollisionFlags;
friend class PhysicsManager;
};
struct ControllerColliderHit
{
ScriptingObjectPtr controller;
ScriptingObjectPtr collider;
Vector3f point;
Vector3f normal;
Vector3f motionDirection;
float motionLength;
int push;
};
struct ControllerControllerHit
{
ScriptingObjectPtr controller;
ScriptingObjectPtr other;
short push;
};
|