forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphysxController.h
More file actions
114 lines (88 loc) · 2.41 KB
/
physxController.h
File metadata and controls
114 lines (88 loc) · 2.41 KB
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
113
114
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxController.h
* @author enn0x
* @date 2009-09-24
*/
#ifndef PHYSXCONTROLLER_H
#define PHYSXCONTROLLER_H
#include "pandabase.h"
#include "pointerTo.h"
#include "luse.h"
#include "physxObject.h"
#include "physxEnums.h"
#include "physx_includes.h"
class PhysxActor;
/**
* Abstract base class for character controllers.
*/
class EXPCL_PANDAPHYSX PhysxController : public PhysxObject, public PhysxEnums {
PUBLISHED:
void release();
PhysxActor *get_actor() const;
void set_pos(const LPoint3f &pos);
void set_sharpness(float sharpness);
void set_collision(bool enable);
void set_min_distance(float min_dist);
void set_step_offset(float offset);
LPoint3f get_pos() const;
float get_sharpness() const;
void set_global_speed(const LVector3f &speed);
void set_local_speed(const LVector3f &speed);
void set_omega(float omega);
void set_h(float heading);
float get_h() const;
void report_scene_changed();
void start_jump(float v0);
void stop_jump();
INLINE void ls() const;
INLINE void ls(std::ostream &out, int indent_level=0) const;
public:
void update_controller(float dt);
static PhysxController *factory(NxControllerType shapeType);
virtual NxController *ptr() const = 0;
virtual void link(NxController *controllerPtr) = 0;
virtual void unlink() = 0;
protected:
INLINE PhysxController();
private:
NxReal get_jump_height(float dt, NxVec3 &gravity);
float _sharpness;
float _min_dist;
bool _jumping;
float _jump_time;
float _jump_v0;
float _omega;
float _heading;
NxVec3 _speed;
NxVec3 _up_vector;
NxQuat _up_quat;
NxQuat _up_quat_inv;
NxHeightFieldAxis _up_axis;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxObject::init_type();
register_type(_type_handle, "PhysxController",
PhysxObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxController.I"
#endif // PHYSXCONTROLLER_H