diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 12 | ||||
-rw-r--r-- | scene/3d/proximity_group_3d.cpp | 9 | ||||
-rw-r--r-- | scene/3d/proximity_group_3d.h | 10 | ||||
-rw-r--r-- | scene/3d/xr_nodes.cpp | 36 | ||||
-rw-r--r-- | scene/3d/xr_nodes.h | 28 |
5 files changed, 29 insertions, 66 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 385b4e81a8..de8f1eea2e 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1135,6 +1135,11 @@ bool KinematicBody3D::separate_raycast_shapes(bool p_infinite_inertia, Collision } void KinematicBody3D::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock) { + if (p_lock) { + locked_axis |= p_axis; + } else { + locked_axis &= (~p_axis); + } PhysicsServer3D::get_singleton()->body_set_axis_lock(get_rid(), p_axis, p_lock); } @@ -1211,9 +1216,10 @@ void KinematicBody3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_slide_count"), &KinematicBody3D::get_slide_count); ClassDB::bind_method(D_METHOD("get_slide_collision", "slide_idx"), &KinematicBody3D::_get_slide_collision); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_x", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_X); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_y", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Y); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_z", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Z); + ADD_GROUP("Axis Lock", "axis_lock_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_motion_x"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_X); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_motion_y"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Y); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_motion_z"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Z); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision/safe_margin", PROPERTY_HINT_RANGE, "0.001,256,0.001"), "set_safe_margin", "get_safe_margin"); } diff --git a/scene/3d/proximity_group_3d.cpp b/scene/3d/proximity_group_3d.cpp index cdc88abf4c..1a0677c603 100644 --- a/scene/3d/proximity_group_3d.cpp +++ b/scene/3d/proximity_group_3d.cpp @@ -179,14 +179,5 @@ void ProximityGroup3D::_bind_methods() { }; ProximityGroup3D::ProximityGroup3D() { - group_version = 0; - dispatch_mode = MODE_PROXY; - - cell_size = 1.0; - grid_radius = Vector3(1, 1, 1); set_notify_transform(true); }; - -ProximityGroup3D::~ProximityGroup3D(){ - -}; diff --git a/scene/3d/proximity_group_3d.h b/scene/3d/proximity_group_3d.h index 780c65e92b..dd3a2f0a87 100644 --- a/scene/3d/proximity_group_3d.h +++ b/scene/3d/proximity_group_3d.h @@ -49,14 +49,14 @@ public: void _notification(int p_what); - DispatchMode dispatch_mode; + DispatchMode dispatch_mode = MODE_PROXY; Map<StringName, uint32_t> groups; String group_name; - float cell_size; - Vector3 grid_radius; - uint32_t group_version; + float cell_size = 1.0; + Vector3 grid_radius = Vector3(1, 1, 1); + uint32_t group_version = 0; void add_groups(int *p_cell, String p_base, int p_depth); void _new_group(StringName p_name); @@ -78,7 +78,7 @@ public: void broadcast(String p_name, Variant p_params); ProximityGroup3D(); - ~ProximityGroup3D(); + ~ProximityGroup3D() {} }; VARIANT_ENUM_CAST(ProximityGroup3D::DispatchMode); diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index f9f6b6905c..f4a514cdd6 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "xr_nodes.h" + #include "core/input/input.h" #include "servers/xr/xr_interface.h" #include "servers/xr_server.h" @@ -168,14 +169,6 @@ Vector<Plane> XRCamera3D::get_frustum() const { return cm.get_projection_planes(get_camera_transform()); }; -XRCamera3D::XRCamera3D(){ - // nothing to do here yet for now.. -}; - -XRCamera3D::~XRCamera3D(){ - // nothing to do here yet for now.. -}; - //////////////////////////////////////////////////////////////////////////////////////////////////// void XRController3D::_notification(int p_what) { @@ -382,16 +375,6 @@ String XRController3D::get_configuration_warning() const { return String(); }; -XRController3D::XRController3D() { - controller_id = 1; - is_active = true; - button_states = 0; -}; - -XRController3D::~XRController3D(){ - // nothing to do here yet for now.. -}; - //////////////////////////////////////////////////////////////////////////////////////////////////// void XRAnchor3D::_notification(int p_what) { @@ -522,15 +505,6 @@ Ref<Mesh> XRAnchor3D::get_mesh() const { return mesh; } -XRAnchor3D::XRAnchor3D() { - anchor_id = 1; - is_active = true; -}; - -XRAnchor3D::~XRAnchor3D(){ - // nothing to do here yet for now.. -}; - //////////////////////////////////////////////////////////////////////////////////////////////////// String XROrigin3D::get_configuration_warning() const { @@ -615,11 +589,3 @@ void XROrigin3D::_notification(int p_what) { } } }; - -XROrigin3D::XROrigin3D() { - tracked_camera = nullptr; -}; - -XROrigin3D::~XROrigin3D(){ - // nothing to do here yet for now.. -}; diff --git a/scene/3d/xr_nodes.h b/scene/3d/xr_nodes.h index 4685328f16..4d4f82aa38 100644 --- a/scene/3d/xr_nodes.h +++ b/scene/3d/xr_nodes.h @@ -57,8 +57,8 @@ public: virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const; virtual Vector<Plane> get_frustum() const; - XRCamera3D(); - ~XRCamera3D(); + XRCamera3D() {} + ~XRCamera3D() {} }; /* @@ -71,9 +71,9 @@ class XRController3D : public Node3D { GDCLASS(XRController3D, Node3D); private: - int controller_id; - bool is_active; - int button_states; + int controller_id = 1; + bool is_active = true; + int button_states = 0; Ref<Mesh> mesh; protected: @@ -99,8 +99,8 @@ public: String get_configuration_warning() const; - XRController3D(); - ~XRController3D(); + XRController3D() {} + ~XRController3D() {} }; /* @@ -112,8 +112,8 @@ class XRAnchor3D : public Node3D { GDCLASS(XRAnchor3D, Node3D); private: - int anchor_id; - bool is_active; + int anchor_id = 1; + bool is_active = true; Vector3 size; Ref<Mesh> mesh; @@ -135,8 +135,8 @@ public: String get_configuration_warning() const; - XRAnchor3D(); - ~XRAnchor3D(); + XRAnchor3D() {} + ~XRAnchor3D() {} }; /* @@ -151,7 +151,7 @@ class XROrigin3D : public Node3D { GDCLASS(XROrigin3D, Node3D); private: - XRCamera3D *tracked_camera; + XRCamera3D *tracked_camera = nullptr; protected: void _notification(int p_what); @@ -166,8 +166,8 @@ public: float get_world_scale() const; void set_world_scale(float p_world_scale); - XROrigin3D(); - ~XROrigin3D(); + XROrigin3D() {} + ~XROrigin3D() {} }; #endif /* XR_NODES_H */ |