29 #ifndef PHYSICS_BODY__H 30 #define PHYSICS_BODY__H 32 #include "scene/3d/collision_object.h" 33 #include "servers/physics_server.h" 44 static void _bind_methods();
45 void _notification(
int p_what);
49 virtual Vector3 get_linear_velocity()
const;
50 virtual Vector3 get_angular_velocity()
const;
51 virtual float get_inverse_mass()
const;
53 void set_layer_mask(uint32_t p_mask);
54 uint32_t get_layer_mask()
const;
56 void add_collision_exception_with(
Node* p_node);
57 void remove_collision_exception_with(
Node* p_node);
69 Vector3 constant_linear_velocity;
70 Vector3 constant_angular_velocity;
78 static void _bind_methods();
83 void set_friction(real_t p_friction);
84 real_t get_friction()
const;
86 void set_bounce(real_t p_bounce);
87 real_t get_bounce()
const;
90 void set_constant_linear_velocity(
const Vector3& p_vel);
91 void set_constant_angular_velocity(
const Vector3& p_vel);
93 Vector3 get_constant_linear_velocity()
const;
94 Vector3 get_constant_angular_velocity()
const;
123 PhysicsDirectBodyState *state;
132 real_t gravity_scale;
142 int max_contacts_reported;
144 bool custom_integrator;
152 bool operator<(
const ShapePair& p_sp)
const {
153 if (body_shape==p_sp.body_shape)
154 return local_shape < p_sp.local_shape;
156 return body_shape < p_sp.body_shape;
160 ShapePair(
int p_bs,
int p_ls) { body_shape=p_bs; local_shape=p_ls; }
162 struct RigidBody_RemoveAction {
176 struct ContactMonitor {
184 ContactMonitor *contact_monitor;
185 void _body_enter_tree(ObjectID p_id);
186 void _body_exit_tree(ObjectID p_id);
189 void _body_inout(
int p_status, ObjectID p_instance,
int p_body_shape,
int p_local_shape);
190 void _direct_state_changed(
Object *p_state);
195 void _notification(
int p_what);
196 static void _bind_methods();
199 void set_mode(Mode p_mode);
200 Mode get_mode()
const;
202 void set_mass(real_t p_mass);
203 real_t get_mass()
const;
205 virtual float get_inverse_mass()
const {
return 1.0/mass; }
207 void set_weight(real_t p_weight);
208 real_t get_weight()
const;
210 void set_friction(real_t p_friction);
211 real_t get_friction()
const;
213 void set_bounce(real_t p_bounce);
214 real_t get_bounce()
const;
216 void set_linear_velocity(
const Vector3& p_velocity);
217 Vector3 get_linear_velocity()
const;
219 void set_axis_velocity(
const Vector3& p_axis);
221 void set_angular_velocity(
const Vector3&p_velocity);
222 Vector3 get_angular_velocity()
const;
224 void set_gravity_scale(real_t p_gravity_scale);
225 real_t get_gravity_scale()
const;
227 void set_linear_damp(real_t p_linear_damp);
228 real_t get_linear_damp()
const;
230 void set_angular_damp(real_t p_angular_damp);
231 real_t get_angular_damp()
const;
234 void set_use_custom_integrator(
bool p_enable);
235 bool is_using_custom_integrator();
237 void set_sleeping(
bool p_sleeping);
238 bool is_sleeping()
const;
240 void set_can_sleep(
bool p_active);
241 bool is_able_to_sleep()
const;
243 void set_contact_monitor(
bool p_enabled);
244 bool is_contact_monitor_enabled()
const;
246 void set_max_contacts_reported(
int p_amount);
247 int get_max_contacts_reported()
const;
249 void set_use_continuous_collision_detection(
bool p_enable);
250 bool is_using_continuous_collision_detection()
const;
252 void set_axis_lock(AxisLock p_lock);
253 AxisLock get_axis_lock()
const;
255 Array get_colliding_bodies()
const;
257 void apply_impulse(
const Vector3& p_pos,
const Vector3& p_impulse);
264 VARIANT_ENUM_CAST(RigidBody::Mode);
265 VARIANT_ENUM_CAST(RigidBody::AxisLock);
278 bool collide_kinematic;
279 bool collide_character;
292 _FORCE_INLINE_
bool _ignores_mode(PhysicsServer::BodyMode)
const;
295 static void _bind_methods();
307 bool can_teleport_to(
const Vector3& p_position);
308 bool is_colliding()
const;
309 Vector3 get_collision_pos()
const;
310 Vector3 get_collision_normal()
const;
311 Vector3 get_collider_velocity()
const;
312 ObjectID get_collider()
const;
313 int get_collider_shape()
const;
315 void set_collide_with_static_bodies(
bool p_enable);
316 bool can_collide_with_static_bodies()
const;
318 void set_collide_with_rigid_bodies(
bool p_enable);
319 bool can_collide_with_rigid_bodies()
const;
321 void set_collide_with_kinematic_bodies(
bool p_enable);
322 bool can_collide_with_kinematic_bodies()
const;
324 void set_collide_with_character_bodies(
bool p_enable);
325 bool can_collide_with_character_bodies()
const;
327 void set_collision_margin(
float p_margin);
328 float get_collision_margin()
const;
335 #endif // PHYSICS_BODY__H Definition: tween_interpolaters.cpp:313
Definition: physics_body.h:65
Definition: physics_body.h:101
Definition: physics_body.h:271
Definition: collision_object.h:35
Definition: physics_body.h:37