summaryrefslogtreecommitdiff
path: root/scene/3d/physics_body_3d.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/physics_body_3d.h')
-rw-r--r--scene/3d/physics_body_3d.h62
1 files changed, 32 insertions, 30 deletions
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index e4a41be6c0..4b874b91d9 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -50,11 +50,11 @@ protected:
uint16_t locked_axis = 0;
- Ref<KinematicCollision3D> _move(const Vector3 &p_distance, bool p_test_only = false, real_t p_margin = 0.001, int p_max_collisions = 1);
+ Ref<KinematicCollision3D> _move(const Vector3 &p_distance, bool p_test_only = false, real_t p_margin = 0.001, bool p_recovery_as_collision = false, int p_max_collisions = 1);
public:
bool move_and_collide(const PhysicsServer3D::MotionParameters &p_parameters, PhysicsServer3D::MotionResult &r_result, bool p_test_only = false, bool p_cancel_sliding = true);
- bool test_move(const Transform3D &p_from, const Vector3 &p_distance, const Ref<KinematicCollision3D> &r_collision = Ref<KinematicCollision3D>(), real_t p_margin = 0.001, int p_max_collisions = 1);
+ bool test_move(const Transform3D &p_from, const Vector3 &p_distance, const Ref<KinematicCollision3D> &r_collision = Ref<KinematicCollision3D>(), real_t p_margin = 0.001, bool p_recovery_as_collision = false, int p_max_collisions = 1);
void set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock);
bool get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const;
@@ -129,8 +129,8 @@ private:
bool is_sync_to_physics_enabled() const;
};
-class RigidDynamicBody3D : public PhysicsBody3D {
- GDCLASS(RigidDynamicBody3D, PhysicsBody3D);
+class RigidBody3D : public PhysicsBody3D {
+ GDCLASS(RigidBody3D, PhysicsBody3D);
public:
enum FreezeMode {
@@ -198,7 +198,7 @@ private:
tagged = false;
}
};
- struct RigidDynamicBody3D_RemoveAction {
+ struct RigidBody3D_RemoveAction {
RID rid;
ObjectID body_id;
ShapePair pair;
@@ -226,7 +226,7 @@ protected:
void _notification(int p_what);
static void _bind_methods();
- virtual void _validate_property(PropertyInfo &property) const override;
+ void _validate_property(PropertyInfo &p_property) const;
GDVIRTUAL1(_integrate_forces, PhysicsDirectBodyState3D *)
@@ -300,11 +300,12 @@ public:
void set_max_contacts_reported(int p_amount);
int get_max_contacts_reported() const;
+ int get_contact_count() const;
void set_use_continuous_collision_detection(bool p_enable);
bool is_using_continuous_collision_detection() const;
- Array get_colliding_bodies() const;
+ TypedArray<Node3D> get_colliding_bodies() const;
void apply_central_impulse(const Vector3 &p_impulse);
void apply_impulse(const Vector3 &p_impulse, const Vector3 &p_position = Vector3());
@@ -324,18 +325,18 @@ public:
void set_constant_torque(const Vector3 &p_torque);
Vector3 get_constant_torque() const;
- virtual TypedArray<String> get_configuration_warnings() const override;
+ virtual PackedStringArray get_configuration_warnings() const override;
- RigidDynamicBody3D();
- ~RigidDynamicBody3D();
+ RigidBody3D();
+ ~RigidBody3D();
private:
void _reload_physics_characteristics();
};
-VARIANT_ENUM_CAST(RigidDynamicBody3D::FreezeMode);
-VARIANT_ENUM_CAST(RigidDynamicBody3D::CenterOfMassMode);
-VARIANT_ENUM_CAST(RigidDynamicBody3D::DampMode);
+VARIANT_ENUM_CAST(RigidBody3D::FreezeMode);
+VARIANT_ENUM_CAST(RigidBody3D::CenterOfMassMode);
+VARIANT_ENUM_CAST(RigidBody3D::DampMode);
class KinematicCollision3D;
@@ -347,10 +348,10 @@ public:
MOTION_MODE_GROUNDED,
MOTION_MODE_FLOATING,
};
- enum MovingPlatformApplyVelocityOnLeave {
- PLATFORM_VEL_ON_LEAVE_ALWAYS,
- PLATFORM_VEL_ON_LEAVE_UPWARD_ONLY,
- PLATFORM_VEL_ON_LEAVE_NEVER,
+ enum PlatformOnLeave {
+ PLATFORM_ON_LEAVE_ADD_VELOCITY,
+ PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY,
+ PLATFORM_ON_LEAVE_DO_NOTHING,
};
bool move_and_slide();
@@ -382,7 +383,7 @@ public:
private:
real_t margin = 0.001;
MotionMode motion_mode = MOTION_MODE_GROUNDED;
- MovingPlatformApplyVelocityOnLeave moving_platform_apply_velocity_on_leave = PLATFORM_VEL_ON_LEAVE_ALWAYS;
+ PlatformOnLeave platform_on_leave = PLATFORM_ON_LEAVE_ADD_VELOCITY;
union CollisionState {
uint32_t state = 0;
struct {
@@ -410,11 +411,11 @@ private:
int platform_layer = 0;
RID platform_rid;
ObjectID platform_object_id;
- uint32_t moving_platform_floor_layers = UINT32_MAX;
- uint32_t moving_platform_wall_layers = 0;
+ uint32_t platform_floor_layers = UINT32_MAX;
+ uint32_t platform_wall_layers = 0;
real_t floor_snap_length = 0.1;
- real_t floor_max_angle = Math::deg2rad((real_t)45.0);
- real_t wall_min_slide_angle = Math::deg2rad((real_t)15.0);
+ real_t floor_max_angle = Math::deg_to_rad((real_t)45.0);
+ real_t wall_min_slide_angle = Math::deg_to_rad((real_t)15.0);
Vector3 up_direction = Vector3(0.0, 1.0, 0.0);
Vector3 velocity;
Vector3 floor_normal;
@@ -456,17 +457,17 @@ private:
real_t get_wall_min_slide_angle() const;
void set_wall_min_slide_angle(real_t p_radians);
- uint32_t get_moving_platform_floor_layers() const;
- void set_moving_platform_floor_layers(const uint32_t p_exclude_layer);
+ uint32_t get_platform_floor_layers() const;
+ void set_platform_floor_layers(const uint32_t p_exclude_layer);
- uint32_t get_moving_platform_wall_layers() const;
- void set_moving_platform_wall_layers(const uint32_t p_exclude_layer);
+ uint32_t get_platform_wall_layers() const;
+ void set_platform_wall_layers(const uint32_t p_exclude_layer);
void set_motion_mode(MotionMode p_mode);
MotionMode get_motion_mode() const;
- void set_moving_platform_apply_velocity_on_leave(MovingPlatformApplyVelocityOnLeave p_on_leave_velocity);
- MovingPlatformApplyVelocityOnLeave get_moving_platform_apply_velocity_on_leave() const;
+ void set_platform_on_leave(PlatformOnLeave p_on_leave_velocity);
+ PlatformOnLeave get_platform_on_leave() const;
void _move_and_slide_floating(double p_delta);
void _move_and_slide_grounded(double p_delta, bool p_was_on_floor);
@@ -483,11 +484,11 @@ private:
protected:
void _notification(int p_what);
static void _bind_methods();
- virtual void _validate_property(PropertyInfo &property) const override;
+ void _validate_property(PropertyInfo &p_property) const;
};
VARIANT_ENUM_CAST(CharacterBody3D::MotionMode);
-VARIANT_ENUM_CAST(CharacterBody3D::MovingPlatformApplyVelocityOnLeave);
+VARIANT_ENUM_CAST(CharacterBody3D::PlatformOnLeave);
class KinematicCollision3D : public RefCounted {
GDCLASS(KinematicCollision3D, RefCounted);
@@ -504,6 +505,7 @@ public:
Vector3 get_travel() const;
Vector3 get_remainder() const;
int get_collision_count() const;
+ real_t get_depth() const;
Vector3 get_position(int p_collision_index = 0) const;
Vector3 get_normal(int p_collision_index = 0) const;
real_t get_angle(int p_collision_index = 0, const Vector3 &p_up_direction = Vector3(0.0, 1.0, 0.0)) const;