Rename RayShape to SeparationRayShape

Makes it clearer that it's used for special cases when picking a
collision shape.
This commit is contained in:
PouleyKetchoupp 2021-08-19 11:21:56 -07:00
parent aa4791735d
commit 3d5dc80348
37 changed files with 194 additions and 192 deletions

View file

@ -717,11 +717,6 @@
Sets a joint parameter. See [enum JointParam] for a list of available parameters. Sets a joint parameter. See [enum JointParam] for a list of available parameters.
</description> </description>
</method> </method>
<method name="ray_shape_create">
<return type="RID" />
<description>
</description>
</method>
<method name="rectangle_shape_create"> <method name="rectangle_shape_create">
<return type="RID" /> <return type="RID" />
<description> <description>
@ -732,6 +727,11 @@
<description> <description>
</description> </description>
</method> </method>
<method name="separation_ray_shape_create">
<return type="RID" />
<description>
</description>
</method>
<method name="set_active"> <method name="set_active">
<return type="void" /> <return type="void" />
<argument index="0" name="active" type="bool" /> <argument index="0" name="active" type="bool" />
@ -846,7 +846,8 @@
<constant name="SHAPE_WORLD_MARGIN" value="0" enum="ShapeType"> <constant name="SHAPE_WORLD_MARGIN" value="0" enum="ShapeType">
This is the constant for creating world margin shapes. A world margin shape is an [i]infinite[/i] line with an origin point, and a normal. Thus, it can be used for front/behind checks. This is the constant for creating world margin shapes. A world margin shape is an [i]infinite[/i] line with an origin point, and a normal. Thus, it can be used for front/behind checks.
</constant> </constant>
<constant name="SHAPE_RAY" value="1" enum="ShapeType"> <constant name="SHAPE_SEPARATION_RAY" value="1" enum="ShapeType">
This is the constant for creating separation ray shapes. A separation ray is defined by a length and separates itself from what is touching its far endpoint. Useful for character controllers.
</constant> </constant>
<constant name="SHAPE_SEGMENT" value="2" enum="ShapeType"> <constant name="SHAPE_SEGMENT" value="2" enum="ShapeType">
This is the constant for creating segment shapes. A segment shape is a [i]finite[/i] line from a point A to a point B. It can be checked for intersections. This is the constant for creating segment shapes. A segment shape is a [i]finite[/i] line from a point A to a point B. It can be checked for intersections.

View file

@ -850,7 +850,7 @@
<description> <description>
</description> </description>
</method> </method>
<method name="ray_shape_create"> <method name="separation_ray_shape_create">
<return type="RID" /> <return type="RID" />
<description> <description>
</description> </description>
@ -1177,8 +1177,8 @@
<constant name="SHAPE_PLANE" value="0" enum="ShapeType"> <constant name="SHAPE_PLANE" value="0" enum="ShapeType">
The [Shape3D] is a [WorldMarginShape3D]. The [Shape3D] is a [WorldMarginShape3D].
</constant> </constant>
<constant name="SHAPE_RAY" value="1" enum="ShapeType"> <constant name="SHAPE_SEPARATION_RAY" value="1" enum="ShapeType">
The [Shape3D] is a [RayShape3D]. The [Shape3D] is a [SeparationRayShape3D].
</constant> </constant>
<constant name="SHAPE_SPHERE" value="2" enum="ShapeType"> <constant name="SHAPE_SPHERE" value="2" enum="ShapeType">
The [Shape3D] is a [SphereShape3D]. The [Shape3D] is a [SphereShape3D].

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="RayShape3D" inherits="Shape3D" version="4.0"> <class name="SeparationRayShape2D" inherits="Shape2D" version="4.0">
<brief_description> <brief_description>
Ray shape for 3D collisions. Separation ray shape for 2D collisions.
</brief_description> </brief_description>
<description> <description>
Ray shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. Separation ray shape for 2D collisions. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<methods> <methods>
</methods> </methods>
<members> <members>
<member name="length" type="float" setter="set_length" getter="get_length" default="1.0"> <member name="length" type="float" setter="set_length" getter="get_length" default="20.0">
The ray's length. The ray's length.
</member> </member>
<member name="slide_on_slope" type="bool" setter="set_slide_on_slope" getter="get_slide_on_slope" default="false"> <member name="slide_on_slope" type="bool" setter="set_slide_on_slope" getter="get_slide_on_slope" default="false">

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="RayShape2D" inherits="Shape2D" version="4.0"> <class name="SeparationRayShape3D" inherits="Shape3D" version="4.0">
<brief_description> <brief_description>
Ray shape for 2D collisions. Separation ray shape for 3D collisions.
</brief_description> </brief_description>
<description> <description>
Ray shape for 2D collisions. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. Separation ray shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<methods> <methods>
</methods> </methods>
<members> <members>
<member name="length" type="float" setter="set_length" getter="get_length" default="20.0"> <member name="length" type="float" setter="set_length" getter="get_length" default="1.0">
The ray's length. The ray's length.
</member> </member>
<member name="slide_on_slope" type="bool" setter="set_slide_on_slope" getter="get_slide_on_slope" default="false"> <member name="slide_on_slope" type="bool" setter="set_slide_on_slope" getter="get_slide_on_slope" default="false">

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

View file

@ -45,8 +45,8 @@
#include "scene/resources/animation.h" #include "scene/resources/animation.h"
#include "scene/resources/box_shape_3d.h" #include "scene/resources/box_shape_3d.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "scene/resources/ray_shape_3d.h"
#include "scene/resources/resource_format_text.h" #include "scene/resources/resource_format_text.h"
#include "scene/resources/separation_ray_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h" #include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/surface_tool.h" #include "scene/resources/surface_tool.h"
#include "scene/resources/world_margin_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h"
@ -381,7 +381,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
boxShape->set_size(Vector3(2, 2, 2)); boxShape->set_size(Vector3(2, 2, 2));
colshape->set_shape(boxShape); colshape->set_shape(boxShape);
} else if (empty_draw_type == "SINGLE_ARROW") { } else if (empty_draw_type == "SINGLE_ARROW") {
RayShape3D *rayShape = memnew(RayShape3D); SeparationRayShape3D *rayShape = memnew(SeparationRayShape3D);
rayShape->set_length(1); rayShape->set_length(1);
colshape->set_shape(rayShape); colshape->set_shape(rayShape);
Object::cast_to<Node3D>(sb)->rotate_x(Math_PI / 2); Object::cast_to<Node3D>(sb)->rotate_x(Math_PI / 2);

View file

@ -36,9 +36,9 @@
#include "scene/resources/circle_shape_2d.h" #include "scene/resources/circle_shape_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h" #include "scene/resources/concave_polygon_shape_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h" #include "scene/resources/convex_polygon_shape_2d.h"
#include "scene/resources/ray_shape_2d.h"
#include "scene/resources/rectangle_shape_2d.h" #include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/segment_shape_2d.h" #include "scene/resources/segment_shape_2d.h"
#include "scene/resources/separation_ray_shape_2d.h"
#include "scene/resources/world_margin_shape_2d.h" #include "scene/resources/world_margin_shape_2d.h"
void CollisionShape2DEditor::_node_removed(Node *p_node) { void CollisionShape2DEditor::_node_removed(Node *p_node) {
@ -81,8 +81,8 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
} break; } break;
case RAY_SHAPE: { case SEPARATION_RAY_SHAPE: {
Ref<RayShape2D> ray = node->get_shape(); Ref<SeparationRayShape2D> ray = node->get_shape();
if (idx == 0) { if (idx == 0) {
return ray->get_length(); return ray->get_length();
@ -162,8 +162,8 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
} break; } break;
case RAY_SHAPE: { case SEPARATION_RAY_SHAPE: {
Ref<RayShape2D> ray = node->get_shape(); Ref<SeparationRayShape2D> ray = node->get_shape();
ray->set_length(Math::abs(p_point.y)); ray->set_length(Math::abs(p_point.y));
@ -272,8 +272,8 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
} break; } break;
case RAY_SHAPE: { case SEPARATION_RAY_SHAPE: {
Ref<RayShape2D> ray = node->get_shape(); Ref<SeparationRayShape2D> ray = node->get_shape();
undo_redo->add_do_method(ray.ptr(), "set_length", ray->get_length()); undo_redo->add_do_method(ray.ptr(), "set_length", ray->get_length());
undo_redo->add_do_method(canvas_item_editor, "update_viewport"); undo_redo->add_do_method(canvas_item_editor, "update_viewport");
@ -423,8 +423,8 @@ void CollisionShape2DEditor::_get_current_shape_type() {
shape_type = CONVEX_POLYGON_SHAPE; shape_type = CONVEX_POLYGON_SHAPE;
} else if (Object::cast_to<WorldMarginShape2D>(*s)) { } else if (Object::cast_to<WorldMarginShape2D>(*s)) {
shape_type = WORLD_MARGIN_SHAPE; shape_type = WORLD_MARGIN_SHAPE;
} else if (Object::cast_to<RayShape2D>(*s)) { } else if (Object::cast_to<SeparationRayShape2D>(*s)) {
shape_type = RAY_SHAPE; shape_type = SEPARATION_RAY_SHAPE;
} else if (Object::cast_to<RectangleShape2D>(*s)) { } else if (Object::cast_to<RectangleShape2D>(*s)) {
shape_type = RECTANGLE_SHAPE; shape_type = RECTANGLE_SHAPE;
} else if (Object::cast_to<SegmentShape2D>(*s)) { } else if (Object::cast_to<SegmentShape2D>(*s)) {
@ -502,8 +502,8 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break; } break;
case RAY_SHAPE: { case SEPARATION_RAY_SHAPE: {
Ref<RayShape2D> shape = node->get_shape(); Ref<SeparationRayShape2D> shape = node->get_shape();
handles.resize(1); handles.resize(1);
handles.write[0] = Point2(0, shape->get_length()); handles.write[0] = Point2(0, shape->get_length());

View file

@ -47,7 +47,7 @@ class CollisionShape2DEditor : public Control {
CONCAVE_POLYGON_SHAPE, CONCAVE_POLYGON_SHAPE,
CONVEX_POLYGON_SHAPE, CONVEX_POLYGON_SHAPE,
WORLD_MARGIN_SHAPE, WORLD_MARGIN_SHAPE,
RAY_SHAPE, SEPARATION_RAY_SHAPE,
RECTANGLE_SHAPE, RECTANGLE_SHAPE,
SEGMENT_SHAPE SEGMENT_SHAPE
}; };

View file

@ -66,7 +66,7 @@
#include "scene/resources/cylinder_shape_3d.h" #include "scene/resources/cylinder_shape_3d.h"
#include "scene/resources/height_map_shape_3d.h" #include "scene/resources/height_map_shape_3d.h"
#include "scene/resources/primitive_meshes.h" #include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape_3d.h" #include "scene/resources/separation_ray_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h" #include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/surface_tool.h" #include "scene/resources/surface_tool.h"
#include "scene/resources/world_margin_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h"
@ -4068,7 +4068,7 @@ String CollisionShape3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_g
return p_id == 0 ? "Radius" : "Height"; return p_id == 0 ? "Radius" : "Height";
} }
if (Object::cast_to<RayShape3D>(*s)) { if (Object::cast_to<SeparationRayShape3D>(*s)) {
return "Length"; return "Length";
} }
@ -4103,8 +4103,8 @@ Variant CollisionShape3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p
return p_id == 0 ? cs2->get_radius() : cs2->get_height(); return p_id == 0 ? cs2->get_radius() : cs2->get_height();
} }
if (Object::cast_to<RayShape3D>(*s)) { if (Object::cast_to<SeparationRayShape3D>(*s)) {
Ref<RayShape3D> cs2 = s; Ref<SeparationRayShape3D> cs2 = s;
return cs2->get_length(); return cs2->get_length();
} }
@ -4143,8 +4143,8 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
ss->set_radius(d); ss->set_radius(d);
} }
if (Object::cast_to<RayShape3D>(*s)) { if (Object::cast_to<SeparationRayShape3D>(*s)) {
Ref<RayShape3D> rs = s; Ref<SeparationRayShape3D> rs = s;
Vector3 ra, rb; Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), Vector3(0, 0, 4096), sg[0], sg[1], ra, rb); Geometry3D::get_closest_points_between_segments(Vector3(), Vector3(0, 0, 4096), sg[0], sg[1], ra, rb);
float d = ra.z; float d = ra.z;
@ -4314,15 +4314,15 @@ void CollisionShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo
ur->commit_action(); ur->commit_action();
} }
if (Object::cast_to<RayShape3D>(*s)) { if (Object::cast_to<SeparationRayShape3D>(*s)) {
Ref<RayShape3D> ss = s; Ref<SeparationRayShape3D> ss = s;
if (p_cancel) { if (p_cancel) {
ss->set_length(p_restore); ss->set_length(p_restore);
return; return;
} }
UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Ray Shape Length")); ur->create_action(TTR("Change Separation Ray Shape Length"));
ur->add_do_method(ss.ptr(), "set_length", ss->get_length()); ur->add_do_method(ss.ptr(), "set_length", ss->get_length());
ur->add_undo_method(ss.ptr(), "set_length", p_restore); ur->add_undo_method(ss.ptr(), "set_length", p_restore);
ur->commit_action(); ur->commit_action();
@ -4597,8 +4597,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_collision_segments(cs2->get_debug_mesh_lines()); p_gizmo->add_collision_segments(cs2->get_debug_mesh_lines());
} }
if (Object::cast_to<RayShape3D>(*s)) { if (Object::cast_to<SeparationRayShape3D>(*s)) {
Ref<RayShape3D> rs = s; Ref<SeparationRayShape3D> rs = s;
Vector<Vector3> points; Vector<Vector3> points;
points.push_back(Vector3()); points.push_back(Vector3());

View file

@ -157,11 +157,11 @@
#include "scene/resources/physics_material.h" #include "scene/resources/physics_material.h"
#include "scene/resources/polygon_path_finder.h" #include "scene/resources/polygon_path_finder.h"
#include "scene/resources/primitive_meshes.h" #include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape_2d.h"
#include "scene/resources/ray_shape_3d.h"
#include "scene/resources/rectangle_shape_2d.h" #include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/resource_format_text.h" #include "scene/resources/resource_format_text.h"
#include "scene/resources/segment_shape_2d.h" #include "scene/resources/segment_shape_2d.h"
#include "scene/resources/separation_ray_shape_2d.h"
#include "scene/resources/separation_ray_shape_3d.h"
#include "scene/resources/skeleton_modification_2d.h" #include "scene/resources/skeleton_modification_2d.h"
#include "scene/resources/skeleton_modification_2d_ccdik.h" #include "scene/resources/skeleton_modification_2d_ccdik.h"
#include "scene/resources/skeleton_modification_2d_fabrik.h" #include "scene/resources/skeleton_modification_2d_fabrik.h"
@ -754,7 +754,7 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init OS::get_singleton()->yield(); //may take time to init
GDREGISTER_VIRTUAL_CLASS(Shape3D); GDREGISTER_VIRTUAL_CLASS(Shape3D);
GDREGISTER_CLASS(RayShape3D); GDREGISTER_CLASS(SeparationRayShape3D);
GDREGISTER_CLASS(SphereShape3D); GDREGISTER_CLASS(SphereShape3D);
GDREGISTER_CLASS(BoxShape3D); GDREGISTER_CLASS(BoxShape3D);
GDREGISTER_CLASS(CapsuleShape3D); GDREGISTER_CLASS(CapsuleShape3D);
@ -843,7 +843,7 @@ void register_scene_types() {
GDREGISTER_VIRTUAL_CLASS(Shape2D); GDREGISTER_VIRTUAL_CLASS(Shape2D);
GDREGISTER_CLASS(WorldMarginShape2D); GDREGISTER_CLASS(WorldMarginShape2D);
GDREGISTER_CLASS(SegmentShape2D); GDREGISTER_CLASS(SegmentShape2D);
GDREGISTER_CLASS(RayShape2D); GDREGISTER_CLASS(SeparationRayShape2D);
GDREGISTER_CLASS(CircleShape2D); GDREGISTER_CLASS(CircleShape2D);
GDREGISTER_CLASS(RectangleShape2D); GDREGISTER_CLASS(RectangleShape2D);
GDREGISTER_CLASS(CapsuleShape2D); GDREGISTER_CLASS(CapsuleShape2D);
@ -964,7 +964,8 @@ void register_scene_types() {
ClassDB::add_compatibility_class("ProceduralSky", "Sky"); ClassDB::add_compatibility_class("ProceduralSky", "Sky");
ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D"); ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D");
ClassDB::add_compatibility_class("RayCast", "RayCast3D"); ClassDB::add_compatibility_class("RayCast", "RayCast3D");
ClassDB::add_compatibility_class("RayShape", "RayShape3D"); ClassDB::add_compatibility_class("RayShape", "SeparationRayShape3D");
ClassDB::add_compatibility_class("RayShape2D", "SeparationRayShape2D");
ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D"); ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D");
ClassDB::add_compatibility_class("RigidBody", "RigidBody3D"); ClassDB::add_compatibility_class("RigidBody", "RigidBody3D");
ClassDB::add_compatibility_class("Shape", "Shape3D"); ClassDB::add_compatibility_class("Shape", "Shape3D");

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* ray_shape_2d.cpp */ /* separation_ray_shape_2d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,12 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "ray_shape_2d.h" #include "separation_ray_shape_2d.h"
#include "servers/physics_server_2d.h" #include "servers/physics_server_2d.h"
#include "servers/rendering_server.h" #include "servers/rendering_server.h"
void RayShape2D::_update_shape() { void SeparationRayShape2D::_update_shape() {
Dictionary d; Dictionary d;
d["length"] = length; d["length"] = length;
d["slide_on_slope"] = slide_on_slope; d["slide_on_slope"] = slide_on_slope;
@ -41,7 +41,7 @@ void RayShape2D::_update_shape() {
emit_changed(); emit_changed();
} }
void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) { void SeparationRayShape2D::draw(const RID &p_to_rid, const Color &p_color) {
const Vector2 target_position = Vector2(0, get_length()); const Vector2 target_position = Vector2(0, get_length());
const float max_arrow_size = 6; const float max_arrow_size = 6;
@ -72,7 +72,7 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) {
RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID()); RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID());
} }
Rect2 RayShape2D::get_rect() const { Rect2 SeparationRayShape2D::get_rect() const {
Rect2 rect; Rect2 rect;
rect.position = Vector2(); rect.position = Vector2();
rect.expand_to(Vector2(0, length)); rect.expand_to(Vector2(0, length));
@ -80,40 +80,40 @@ Rect2 RayShape2D::get_rect() const {
return rect; return rect;
} }
real_t RayShape2D::get_enclosing_radius() const { real_t SeparationRayShape2D::get_enclosing_radius() const {
return length; return length;
} }
void RayShape2D::_bind_methods() { void SeparationRayShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_length", "length"), &RayShape2D::set_length); ClassDB::bind_method(D_METHOD("set_length", "length"), &SeparationRayShape2D::set_length);
ClassDB::bind_method(D_METHOD("get_length"), &RayShape2D::get_length); ClassDB::bind_method(D_METHOD("get_length"), &SeparationRayShape2D::get_length);
ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &RayShape2D::set_slide_on_slope); ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &SeparationRayShape2D::set_slide_on_slope);
ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &RayShape2D::get_slide_on_slope); ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &SeparationRayShape2D::get_slide_on_slope);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length"), "set_length", "get_length"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slide_on_slope"), "set_slide_on_slope", "get_slide_on_slope"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slide_on_slope"), "set_slide_on_slope", "get_slide_on_slope");
} }
void RayShape2D::set_length(real_t p_length) { void SeparationRayShape2D::set_length(real_t p_length) {
length = p_length; length = p_length;
_update_shape(); _update_shape();
} }
real_t RayShape2D::get_length() const { real_t SeparationRayShape2D::get_length() const {
return length; return length;
} }
void RayShape2D::set_slide_on_slope(bool p_active) { void SeparationRayShape2D::set_slide_on_slope(bool p_active) {
slide_on_slope = p_active; slide_on_slope = p_active;
_update_shape(); _update_shape();
} }
bool RayShape2D::get_slide_on_slope() const { bool SeparationRayShape2D::get_slide_on_slope() const {
return slide_on_slope; return slide_on_slope;
} }
RayShape2D::RayShape2D() : SeparationRayShape2D::SeparationRayShape2D() :
Shape2D(PhysicsServer2D::get_singleton()->ray_shape_create()) { Shape2D(PhysicsServer2D::get_singleton()->separation_ray_shape_create()) {
_update_shape(); _update_shape();
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* ray_shape_2d.h */ /* separation_ray_shape_2d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,13 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef RAY_SHAPE_2D_H #ifndef SEPARATION_RAY_SHAPE_2D_H
#define RAY_SHAPE_2D_H #define SEPARATION_RAY_SHAPE_2D_H
#include "scene/resources/shape_2d.h" #include "scene/resources/shape_2d.h"
class RayShape2D : public Shape2D { class SeparationRayShape2D : public Shape2D {
GDCLASS(RayShape2D, Shape2D); GDCLASS(SeparationRayShape2D, Shape2D);
real_t length = 20.0; real_t length = 20.0;
bool slide_on_slope = false; bool slide_on_slope = false;
@ -55,7 +55,7 @@ public:
virtual Rect2 get_rect() const override; virtual Rect2 get_rect() const override;
virtual real_t get_enclosing_radius() const override; virtual real_t get_enclosing_radius() const override;
RayShape2D(); SeparationRayShape2D();
}; };
#endif // RAY_SHAPE_2D_H #endif // SEPARATION_RAY_SHAPE_2D_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* ray_shape_3d.cpp */ /* separation_ray_shape_3d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "ray_shape_3d.h" #include "separation_ray_shape_3d.h"
#include "servers/physics_server_3d.h" #include "servers/physics_server_3d.h"
Vector<Vector3> RayShape3D::get_debug_mesh_lines() const { Vector<Vector3> SeparationRayShape3D::get_debug_mesh_lines() const {
Vector<Vector3> points; Vector<Vector3> points;
points.push_back(Vector3()); points.push_back(Vector3());
points.push_back(Vector3(0, 0, get_length())); points.push_back(Vector3(0, 0, get_length()));
@ -40,11 +40,11 @@ Vector<Vector3> RayShape3D::get_debug_mesh_lines() const {
return points; return points;
} }
real_t RayShape3D::get_enclosing_radius() const { real_t SeparationRayShape3D::get_enclosing_radius() const {
return length; return length;
} }
void RayShape3D::_update_shape() { void SeparationRayShape3D::_update_shape() {
Dictionary d; Dictionary d;
d["length"] = length; d["length"] = length;
d["slide_on_slope"] = slide_on_slope; d["slide_on_slope"] = slide_on_slope;
@ -52,39 +52,39 @@ void RayShape3D::_update_shape() {
Shape3D::_update_shape(); Shape3D::_update_shape();
} }
void RayShape3D::set_length(float p_length) { void SeparationRayShape3D::set_length(float p_length) {
length = p_length; length = p_length;
_update_shape(); _update_shape();
notify_change_to_owners(); notify_change_to_owners();
} }
float RayShape3D::get_length() const { float SeparationRayShape3D::get_length() const {
return length; return length;
} }
void RayShape3D::set_slide_on_slope(bool p_active) { void SeparationRayShape3D::set_slide_on_slope(bool p_active) {
slide_on_slope = p_active; slide_on_slope = p_active;
_update_shape(); _update_shape();
notify_change_to_owners(); notify_change_to_owners();
} }
bool RayShape3D::get_slide_on_slope() const { bool SeparationRayShape3D::get_slide_on_slope() const {
return slide_on_slope; return slide_on_slope;
} }
void RayShape3D::_bind_methods() { void SeparationRayShape3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_length", "length"), &RayShape3D::set_length); ClassDB::bind_method(D_METHOD("set_length", "length"), &SeparationRayShape3D::set_length);
ClassDB::bind_method(D_METHOD("get_length"), &RayShape3D::get_length); ClassDB::bind_method(D_METHOD("get_length"), &SeparationRayShape3D::get_length);
ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &RayShape3D::set_slide_on_slope); ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &SeparationRayShape3D::set_slide_on_slope);
ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &RayShape3D::get_slide_on_slope); ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &SeparationRayShape3D::get_slide_on_slope);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_length", "get_length"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slide_on_slope"), "set_slide_on_slope", "get_slide_on_slope"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slide_on_slope"), "set_slide_on_slope", "get_slide_on_slope");
} }
RayShape3D::RayShape3D() : SeparationRayShape3D::SeparationRayShape3D() :
Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_RAY)) { Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_SEPARATION_RAY)) {
/* Code copied from setters to prevent the use of uninitialized variables */ /* Code copied from setters to prevent the use of uninitialized variables */
_update_shape(); _update_shape();
notify_change_to_owners(); notify_change_to_owners();

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* ray_shape_3d.h */ /* separation_ray_shape_3d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,12 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef RAY_SHAPE_H #ifndef SEPARATION_RAY_SHAPE_H
#define RAY_SHAPE_H #define SEPARATION_RAY_SHAPE_H
#include "scene/resources/shape_3d.h" #include "scene/resources/shape_3d.h"
class RayShape3D : public Shape3D { class SeparationRayShape3D : public Shape3D {
GDCLASS(RayShape3D, Shape3D); GDCLASS(SeparationRayShape3D, Shape3D);
float length = 1.0; float length = 1.0;
bool slide_on_slope = false; bool slide_on_slope = false;
@ -51,6 +51,6 @@ public:
virtual Vector<Vector3> get_debug_mesh_lines() const override; virtual Vector<Vector3> get_debug_mesh_lines() const override;
virtual real_t get_enclosing_radius() const override; virtual real_t get_enclosing_radius() const override;
RayShape3D(); SeparationRayShape3D();
}; };
#endif // RAY_SHAPE_H #endif // SEPARATION_RAY_SHAPE_H

View file

@ -1115,13 +1115,13 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
PhysicsServer2D::ShapeType type_A = p_shape_A->get_type(); PhysicsServer2D::ShapeType type_A = p_shape_A->get_type();
ERR_FAIL_COND_V(type_A == PhysicsServer2D::SHAPE_WORLD_MARGIN, false); ERR_FAIL_COND_V(type_A == PhysicsServer2D::SHAPE_WORLD_MARGIN, false);
ERR_FAIL_COND_V(type_A == PhysicsServer2D::SHAPE_RAY, false); ERR_FAIL_COND_V(type_A == PhysicsServer2D::SHAPE_SEPARATION_RAY, false);
ERR_FAIL_COND_V(p_shape_A->is_concave(), false); ERR_FAIL_COND_V(p_shape_A->is_concave(), false);
PhysicsServer2D::ShapeType type_B = p_shape_B->get_type(); PhysicsServer2D::ShapeType type_B = p_shape_B->get_type();
ERR_FAIL_COND_V(type_B == PhysicsServer2D::SHAPE_WORLD_MARGIN, false); ERR_FAIL_COND_V(type_B == PhysicsServer2D::SHAPE_WORLD_MARGIN, false);
ERR_FAIL_COND_V(type_B == PhysicsServer2D::SHAPE_RAY, false); ERR_FAIL_COND_V(type_B == PhysicsServer2D::SHAPE_SEPARATION_RAY, false);
ERR_FAIL_COND_V(p_shape_B->is_concave(), false); ERR_FAIL_COND_V(p_shape_B->is_concave(), false);
static const CollisionFunc collision_table[5][5] = { static const CollisionFunc collision_table[5][5] = {

View file

@ -73,9 +73,9 @@ bool CollisionSolver2DSW::solve_static_world_margin(const Shape2DSW *p_shape_A,
return found; return found;
} }
bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *r_sep_axis, real_t p_margin) { bool CollisionSolver2DSW::solve_separation_ray(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *r_sep_axis, real_t p_margin) {
const RayShape2DSW *ray = static_cast<const RayShape2DSW *>(p_shape_A); const SeparationRayShape2DSW *ray = static_cast<const SeparationRayShape2DSW *>(p_shape_A);
if (p_shape_B->get_type() == PhysicsServer2D::SHAPE_RAY) { if (p_shape_B->get_type() == PhysicsServer2D::SHAPE_SEPARATION_RAY) {
return false; return false;
} }
@ -236,15 +236,15 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
return solve_static_world_margin(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false); return solve_static_world_margin(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
} }
} else if (type_A == PhysicsServer2D::SHAPE_RAY) { } else if (type_A == PhysicsServer2D::SHAPE_SEPARATION_RAY) {
if (type_B == PhysicsServer2D::SHAPE_RAY) { if (type_B == PhysicsServer2D::SHAPE_SEPARATION_RAY) {
return false; //no ray-ray return false; //no ray-ray
} }
if (swap) { if (swap) {
return solve_raycast(p_shape_B, p_motion_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true, r_sep_axis, p_margin_B); return solve_separation_ray(p_shape_B, p_motion_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true, r_sep_axis, p_margin_B);
} else { } else {
return solve_raycast(p_shape_A, p_motion_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false, r_sep_axis, p_margin_A); return solve_separation_ray(p_shape_A, p_motion_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false, r_sep_axis, p_margin_A);
} }
} else if (concave_B) { } else if (concave_B) {

View file

@ -41,7 +41,7 @@ private:
static bool solve_static_world_margin(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result); static bool solve_static_world_margin(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
static void concave_callback(void *p_userdata, Shape2DSW *p_convex); static void concave_callback(void *p_userdata, Shape2DSW *p_convex);
static bool solve_concave(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *r_sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0); static bool solve_concave(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *r_sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
static bool solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *r_sep_axis = nullptr, real_t p_margin = 0); static bool solve_separation_ray(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *r_sep_axis = nullptr, real_t p_margin = 0);
public: public:
static bool solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *r_sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0); static bool solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *r_sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);

View file

@ -45,8 +45,8 @@ RID PhysicsServer2DSW::_shape_create(ShapeType p_shape) {
case SHAPE_WORLD_MARGIN: { case SHAPE_WORLD_MARGIN: {
shape = memnew(WorldMarginShape2DSW); shape = memnew(WorldMarginShape2DSW);
} break; } break;
case SHAPE_RAY: { case SHAPE_SEPARATION_RAY: {
shape = memnew(RayShape2DSW); shape = memnew(SeparationRayShape2DSW);
} break; } break;
case SHAPE_SEGMENT: { case SHAPE_SEGMENT: {
shape = memnew(SegmentShape2DSW); shape = memnew(SegmentShape2DSW);
@ -82,8 +82,8 @@ RID PhysicsServer2DSW::world_margin_shape_create() {
return _shape_create(SHAPE_WORLD_MARGIN); return _shape_create(SHAPE_WORLD_MARGIN);
} }
RID PhysicsServer2DSW::ray_shape_create() { RID PhysicsServer2DSW::separation_ray_shape_create() {
return _shape_create(SHAPE_RAY); return _shape_create(SHAPE_SEPARATION_RAY);
} }
RID PhysicsServer2DSW::segment_shape_create() { RID PhysicsServer2DSW::segment_shape_create() {

View file

@ -88,7 +88,7 @@ public:
}; };
virtual RID world_margin_shape_create() override; virtual RID world_margin_shape_create() override;
virtual RID ray_shape_create() override; virtual RID separation_ray_shape_create() override;
virtual RID segment_shape_create() override; virtual RID segment_shape_create() override;
virtual RID circle_shape_create() override; virtual RID circle_shape_create() override;
virtual RID rectangle_shape_create() override; virtual RID rectangle_shape_create() override;

View file

@ -80,7 +80,7 @@ public:
//FUNC1RID(shape,ShapeType); todo fix //FUNC1RID(shape,ShapeType); todo fix
FUNCRID(world_margin_shape) FUNCRID(world_margin_shape)
FUNCRID(ray_shape) FUNCRID(separation_ray_shape)
FUNCRID(segment_shape) FUNCRID(segment_shape)
FUNCRID(circle_shape) FUNCRID(circle_shape)
FUNCRID(rectangle_shape) FUNCRID(rectangle_shape)

View file

@ -143,7 +143,7 @@ Variant WorldMarginShape2DSW::get_data() const {
/*********************************************************/ /*********************************************************/
/*********************************************************/ /*********************************************************/
void RayShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { void SeparationRayShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const {
r_amount = 1; r_amount = 1;
if (p_normal.y > 0) { if (p_normal.y > 0) {
@ -153,26 +153,26 @@ void RayShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, in
} }
} }
bool RayShape2DSW::contains_point(const Vector2 &p_point) const { bool SeparationRayShape2DSW::contains_point(const Vector2 &p_point) const {
return false; return false;
} }
bool RayShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { bool SeparationRayShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const {
return false; //rays can't be intersected return false; //rays can't be intersected
} }
real_t RayShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { real_t SeparationRayShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const {
return 0; //rays are mass-less return 0; //rays are mass-less
} }
void RayShape2DSW::set_data(const Variant &p_data) { void SeparationRayShape2DSW::set_data(const Variant &p_data) {
Dictionary d = p_data; Dictionary d = p_data;
length = d["length"]; length = d["length"];
slide_on_slope = d["slide_on_slope"]; slide_on_slope = d["slide_on_slope"];
configure(Rect2(0, 0, 0.001, length)); configure(Rect2(0, 0, 0.001, length));
} }
Variant RayShape2DSW::get_data() const { Variant SeparationRayShape2DSW::get_data() const {
Dictionary d; Dictionary d;
d["length"] = length; d["length"] = length;
d["slide_on_slope"] = slide_on_slope; d["slide_on_slope"] = slide_on_slope;

View file

@ -179,7 +179,7 @@ public:
} }
}; };
class RayShape2DSW : public Shape2DSW { class SeparationRayShape2DSW : public Shape2DSW {
real_t length; real_t length;
bool slide_on_slope; bool slide_on_slope;
@ -187,19 +187,19 @@ public:
_FORCE_INLINE_ real_t get_length() const { return length; } _FORCE_INLINE_ real_t get_length() const { return length; }
_FORCE_INLINE_ bool get_slide_on_slope() const { return slide_on_slope; } _FORCE_INLINE_ bool get_slide_on_slope() const { return slide_on_slope; }
virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_RAY; } virtual PhysicsServer2D::ShapeType get_type() const override { return PhysicsServer2D::SHAPE_SEPARATION_RAY; }
virtual bool allows_one_way_collision() const override { return false; } virtual bool allows_one_way_collision() const override { return false; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); } virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const override { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const; virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const override;
virtual bool contains_point(const Vector2 &p_point) const; virtual bool contains_point(const Vector2 &p_point) const override;
virtual bool intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const; virtual bool intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const override;
virtual real_t get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const; virtual real_t get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const override;
virtual void set_data(const Variant &p_data); virtual void set_data(const Variant &p_data) override;
virtual Variant get_data() const; virtual Variant get_data() const override;
_FORCE_INLINE_ void project_range(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { _FORCE_INLINE_ void project_range(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const {
//real large //real large
@ -212,8 +212,8 @@ public:
DEFAULT_PROJECT_RANGE_CAST DEFAULT_PROJECT_RANGE_CAST
_FORCE_INLINE_ RayShape2DSW() {} _FORCE_INLINE_ SeparationRayShape2DSW() {}
_FORCE_INLINE_ RayShape2DSW(real_t p_length) { length = p_length; } _FORCE_INLINE_ SeparationRayShape2DSW(real_t p_length) { length = p_length; }
}; };
class SegmentShape2DSW : public Shape2DSW { class SegmentShape2DSW : public Shape2DSW {

View file

@ -729,9 +729,9 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
// Colliding separation rays allows to properly snap to the ground, // Colliding separation rays allows to properly snap to the ground,
// otherwise it's not needed in regular motion. // otherwise it's not needed in regular motion.
if (!p_collide_separation_ray && (body_shape->get_type() == PhysicsServer2D::SHAPE_RAY)) { if (!p_collide_separation_ray && (body_shape->get_type() == PhysicsServer2D::SHAPE_SEPARATION_RAY)) {
// When slide on slope is on, separation ray shape acts like a regular shape. // When slide on slope is on, separation ray shape acts like a regular shape.
if (!static_cast<RayShape2DSW *>(body_shape)->get_slide_on_slope()) { if (!static_cast<SeparationRayShape2DSW *>(body_shape)->get_slide_on_slope()) {
continue; continue;
} }
} }

View file

@ -2273,13 +2273,13 @@ bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform3D &p_
PhysicsServer3D::ShapeType type_A = p_shape_A->get_type(); PhysicsServer3D::ShapeType type_A = p_shape_A->get_type();
ERR_FAIL_COND_V(type_A == PhysicsServer3D::SHAPE_PLANE, false); ERR_FAIL_COND_V(type_A == PhysicsServer3D::SHAPE_PLANE, false);
ERR_FAIL_COND_V(type_A == PhysicsServer3D::SHAPE_RAY, false); ERR_FAIL_COND_V(type_A == PhysicsServer3D::SHAPE_SEPARATION_RAY, false);
ERR_FAIL_COND_V(p_shape_A->is_concave(), false); ERR_FAIL_COND_V(p_shape_A->is_concave(), false);
PhysicsServer3D::ShapeType type_B = p_shape_B->get_type(); PhysicsServer3D::ShapeType type_B = p_shape_B->get_type();
ERR_FAIL_COND_V(type_B == PhysicsServer3D::SHAPE_PLANE, false); ERR_FAIL_COND_V(type_B == PhysicsServer3D::SHAPE_PLANE, false);
ERR_FAIL_COND_V(type_B == PhysicsServer3D::SHAPE_RAY, false); ERR_FAIL_COND_V(type_B == PhysicsServer3D::SHAPE_SEPARATION_RAY, false);
ERR_FAIL_COND_V(p_shape_B->is_concave(), false); ERR_FAIL_COND_V(p_shape_B->is_concave(), false);
static const CollisionFunc collision_table[6][6] = { static const CollisionFunc collision_table[6][6] = {

View file

@ -89,8 +89,8 @@ bool CollisionSolver3DSW::solve_static_plane(const Shape3DSW *p_shape_A, const T
return found; return found;
} }
bool CollisionSolver3DSW::solve_ray(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin) { bool CollisionSolver3DSW::solve_separation_ray(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin) {
const RayShape3DSW *ray = static_cast<const RayShape3DSW *>(p_shape_A); const SeparationRayShape3DSW *ray = static_cast<const SeparationRayShape3DSW *>(p_shape_A);
Vector3 from = p_transform_A.origin; Vector3 from = p_transform_A.origin;
Vector3 to = from + p_transform_A.basis.get_axis(2) * (ray->get_length() + p_margin); Vector3 to = from + p_transform_A.basis.get_axis(2) * (ray->get_length() + p_margin);
@ -361,7 +361,7 @@ bool CollisionSolver3DSW::solve_static(const Shape3DSW *p_shape_A, const Transfo
if (type_B == PhysicsServer3D::SHAPE_PLANE) { if (type_B == PhysicsServer3D::SHAPE_PLANE) {
return false; return false;
} }
if (type_B == PhysicsServer3D::SHAPE_RAY) { if (type_B == PhysicsServer3D::SHAPE_SEPARATION_RAY) {
return false; return false;
} }
if (type_B == PhysicsServer3D::SHAPE_SOFT_BODY) { if (type_B == PhysicsServer3D::SHAPE_SOFT_BODY) {
@ -374,15 +374,15 @@ bool CollisionSolver3DSW::solve_static(const Shape3DSW *p_shape_A, const Transfo
return solve_static_plane(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false); return solve_static_plane(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
} }
} else if (type_A == PhysicsServer3D::SHAPE_RAY) { } else if (type_A == PhysicsServer3D::SHAPE_SEPARATION_RAY) {
if (type_B == PhysicsServer3D::SHAPE_RAY) { if (type_B == PhysicsServer3D::SHAPE_SEPARATION_RAY) {
return false; return false;
} }
if (swap) { if (swap) {
return solve_ray(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true, p_margin_B); return solve_separation_ray(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true, p_margin_B);
} else { } else {
return solve_ray(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false, p_margin_A); return solve_separation_ray(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false, p_margin_A);
} }
} else if (type_B == PhysicsServer3D::SHAPE_SOFT_BODY) { } else if (type_B == PhysicsServer3D::SHAPE_SOFT_BODY) {

View file

@ -43,7 +43,7 @@ private:
static void soft_body_concave_callback(void *p_userdata, Shape3DSW *p_convex); static void soft_body_concave_callback(void *p_userdata, Shape3DSW *p_convex);
static void concave_callback(void *p_userdata, Shape3DSW *p_convex); static void concave_callback(void *p_userdata, Shape3DSW *p_convex);
static bool solve_static_plane(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result); static bool solve_static_plane(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
static bool solve_ray(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin = 0); static bool solve_separation_ray(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin = 0);
static bool solve_soft_body(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result); static bool solve_soft_body(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
static bool solve_concave(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin_A = 0, real_t p_margin_B = 0); static bool solve_concave(const Shape3DSW *p_shape_A, const Transform3D &p_transform_A, const Shape3DSW *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin_A = 0, real_t p_margin_B = 0);
static void concave_distance_callback(void *p_userdata, Shape3DSW *p_convex); static void concave_distance_callback(void *p_userdata, Shape3DSW *p_convex);

View file

@ -48,8 +48,8 @@ RID PhysicsServer3DSW::plane_shape_create() {
shape->set_self(rid); shape->set_self(rid);
return rid; return rid;
} }
RID PhysicsServer3DSW::ray_shape_create() { RID PhysicsServer3DSW::separation_ray_shape_create() {
Shape3DSW *shape = memnew(RayShape3DSW); Shape3DSW *shape = memnew(SeparationRayShape3DSW);
RID rid = shape_owner.make_rid(shape); RID rid = shape_owner.make_rid(shape);
shape->set_self(rid); shape->set_self(rid);
return rid; return rid;

View file

@ -83,7 +83,7 @@ public:
static void _shape_col_cbk(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata); static void _shape_col_cbk(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata);
virtual RID plane_shape_create() override; virtual RID plane_shape_create() override;
virtual RID ray_shape_create() override; virtual RID separation_ray_shape_create() override;
virtual RID sphere_shape_create() override; virtual RID sphere_shape_create() override;
virtual RID box_shape_create() override; virtual RID box_shape_create() override;
virtual RID capsule_shape_create() override; virtual RID capsule_shape_create() override;

View file

@ -79,7 +79,7 @@ public:
//FUNC1RID(shape,ShapeType); todo fix //FUNC1RID(shape,ShapeType); todo fix
FUNCRID(plane_shape) FUNCRID(plane_shape)
FUNCRID(ray_shape) FUNCRID(separation_ray_shape)
FUNCRID(sphere_shape) FUNCRID(sphere_shape)
FUNCRID(box_shape) FUNCRID(box_shape)
FUNCRID(capsule_shape) FUNCRID(capsule_shape)

View file

@ -166,21 +166,21 @@ PlaneShape3DSW::PlaneShape3DSW() {
// //
real_t RayShape3DSW::get_length() const { real_t SeparationRayShape3DSW::get_length() const {
return length; return length;
} }
bool RayShape3DSW::get_slide_on_slope() const { bool SeparationRayShape3DSW::get_slide_on_slope() const {
return slide_on_slope; return slide_on_slope;
} }
void RayShape3DSW::project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const { void SeparationRayShape3DSW::project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const {
// don't think this will be even used // don't think this will be even used
r_min = 0; r_min = 0;
r_max = 1; r_max = 1;
} }
Vector3 RayShape3DSW::get_support(const Vector3 &p_normal) const { Vector3 SeparationRayShape3DSW::get_support(const Vector3 &p_normal) const {
if (p_normal.z > 0) { if (p_normal.z > 0) {
return Vector3(0, 0, length); return Vector3(0, 0, length);
} else { } else {
@ -188,7 +188,7 @@ Vector3 RayShape3DSW::get_support(const Vector3 &p_normal) const {
} }
} }
void RayShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount, FeatureType &r_type) const { void SeparationRayShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount, FeatureType &r_type) const {
if (Math::abs(p_normal.z) < _EDGE_IS_VALID_SUPPORT_THRESHOLD) { if (Math::abs(p_normal.z) < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
r_amount = 2; r_amount = 2;
r_type = FEATURE_EDGE; r_type = FEATURE_EDGE;
@ -205,15 +205,15 @@ void RayShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_s
} }
} }
bool RayShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const { bool SeparationRayShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
return false; //simply not possible return false; //simply not possible
} }
bool RayShape3DSW::intersect_point(const Vector3 &p_point) const { bool SeparationRayShape3DSW::intersect_point(const Vector3 &p_point) const {
return false; //simply not possible return false; //simply not possible
} }
Vector3 RayShape3DSW::get_closest_point_to(const Vector3 &p_point) const { Vector3 SeparationRayShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
Vector3 s[2] = { Vector3 s[2] = {
Vector3(0, 0, 0), Vector3(0, 0, 0),
Vector3(0, 0, length) Vector3(0, 0, length)
@ -222,29 +222,29 @@ Vector3 RayShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
return Geometry3D::get_closest_point_to_segment(p_point, s); return Geometry3D::get_closest_point_to_segment(p_point, s);
} }
Vector3 RayShape3DSW::get_moment_of_inertia(real_t p_mass) const { Vector3 SeparationRayShape3DSW::get_moment_of_inertia(real_t p_mass) const {
return Vector3(); return Vector3();
} }
void RayShape3DSW::_setup(real_t p_length, bool p_slide_on_slope) { void SeparationRayShape3DSW::_setup(real_t p_length, bool p_slide_on_slope) {
length = p_length; length = p_length;
slide_on_slope = p_slide_on_slope; slide_on_slope = p_slide_on_slope;
configure(AABB(Vector3(0, 0, 0), Vector3(0.1, 0.1, length))); configure(AABB(Vector3(0, 0, 0), Vector3(0.1, 0.1, length)));
} }
void RayShape3DSW::set_data(const Variant &p_data) { void SeparationRayShape3DSW::set_data(const Variant &p_data) {
Dictionary d = p_data; Dictionary d = p_data;
_setup(d["length"], d["slide_on_slope"]); _setup(d["length"], d["slide_on_slope"]);
} }
Variant RayShape3DSW::get_data() const { Variant SeparationRayShape3DSW::get_data() const {
Dictionary d; Dictionary d;
d["length"] = length; d["length"] = length;
d["slide_on_slope"] = slide_on_slope; d["slide_on_slope"] = slide_on_slope;
return d; return d;
} }
RayShape3DSW::RayShape3DSW() { SeparationRayShape3DSW::SeparationRayShape3DSW() {
length = 1; length = 1;
slide_on_slope = false; slide_on_slope = false;
} }

View file

@ -117,24 +117,24 @@ class PlaneShape3DSW : public Shape3DSW {
public: public:
Plane get_plane() const; Plane get_plane() const;
virtual real_t get_area() const { return INFINITY; } virtual real_t get_area() const override { return INFINITY; }
virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_PLANE; } virtual PhysicsServer3D::ShapeType get_type() const override { return PhysicsServer3D::SHAPE_PLANE; }
virtual void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const; virtual void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const override;
virtual Vector3 get_support(const Vector3 &p_normal) const; virtual Vector3 get_support(const Vector3 &p_normal) const override;
virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount, FeatureType &r_type) const { r_amount = 0; } virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount, FeatureType &r_type) const override { r_amount = 0; }
virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const; virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const override;
virtual bool intersect_point(const Vector3 &p_point) const; virtual bool intersect_point(const Vector3 &p_point) const override;
virtual Vector3 get_closest_point_to(const Vector3 &p_point) const; virtual Vector3 get_closest_point_to(const Vector3 &p_point) const override;
virtual Vector3 get_moment_of_inertia(real_t p_mass) const; virtual Vector3 get_moment_of_inertia(real_t p_mass) const override;
virtual void set_data(const Variant &p_data); virtual void set_data(const Variant &p_data) override;
virtual Variant get_data() const; virtual Variant get_data() const override;
PlaneShape3DSW(); PlaneShape3DSW();
}; };
class RayShape3DSW : public Shape3DSW { class SeparationRayShape3DSW : public Shape3DSW {
real_t length; real_t length;
bool slide_on_slope; bool slide_on_slope;
@ -144,22 +144,22 @@ public:
real_t get_length() const; real_t get_length() const;
bool get_slide_on_slope() const; bool get_slide_on_slope() const;
virtual real_t get_area() const { return 0.0; } virtual real_t get_area() const override { return 0.0; }
virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_RAY; } virtual PhysicsServer3D::ShapeType get_type() const override { return PhysicsServer3D::SHAPE_SEPARATION_RAY; }
virtual void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const; virtual void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const override;
virtual Vector3 get_support(const Vector3 &p_normal) const; virtual Vector3 get_support(const Vector3 &p_normal) const override;
virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount, FeatureType &r_type) const; virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount, FeatureType &r_type) const override;
virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const; virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const override;
virtual bool intersect_point(const Vector3 &p_point) const; virtual bool intersect_point(const Vector3 &p_point) const override;
virtual Vector3 get_closest_point_to(const Vector3 &p_point) const; virtual Vector3 get_closest_point_to(const Vector3 &p_point) const override;
virtual Vector3 get_moment_of_inertia(real_t p_mass) const; virtual Vector3 get_moment_of_inertia(real_t p_mass) const override;
virtual void set_data(const Variant &p_data); virtual void set_data(const Variant &p_data) override;
virtual Variant get_data() const; virtual Variant get_data() const override;
RayShape3DSW(); SeparationRayShape3DSW();
}; };
class SphereShape3DSW : public Shape3DSW { class SphereShape3DSW : public Shape3DSW {

View file

@ -718,9 +718,9 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform3D &p_from, co
// Colliding separation rays allows to properly snap to the ground, // Colliding separation rays allows to properly snap to the ground,
// otherwise it's not needed in regular motion. // otherwise it's not needed in regular motion.
if (!p_collide_separation_ray && (body_shape->get_type() == PhysicsServer3D::SHAPE_RAY)) { if (!p_collide_separation_ray && (body_shape->get_type() == PhysicsServer3D::SHAPE_SEPARATION_RAY)) {
// When slide on slope is on, separation ray shape acts like a regular shape. // When slide on slope is on, separation ray shape acts like a regular shape.
if (!static_cast<RayShape3DSW *>(body_shape)->get_slide_on_slope()) { if (!static_cast<SeparationRayShape3DSW *>(body_shape)->get_slide_on_slope()) {
continue; continue;
} }
} }

View file

@ -514,7 +514,7 @@ bool PhysicsServer2D::_body_test_motion(RID p_body, const Transform2D &p_from, c
void PhysicsServer2D::_bind_methods() { void PhysicsServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("world_margin_shape_create"), &PhysicsServer2D::world_margin_shape_create); ClassDB::bind_method(D_METHOD("world_margin_shape_create"), &PhysicsServer2D::world_margin_shape_create);
ClassDB::bind_method(D_METHOD("ray_shape_create"), &PhysicsServer2D::ray_shape_create); ClassDB::bind_method(D_METHOD("separation_ray_shape_create"), &PhysicsServer2D::separation_ray_shape_create);
ClassDB::bind_method(D_METHOD("segment_shape_create"), &PhysicsServer2D::segment_shape_create); ClassDB::bind_method(D_METHOD("segment_shape_create"), &PhysicsServer2D::segment_shape_create);
ClassDB::bind_method(D_METHOD("circle_shape_create"), &PhysicsServer2D::circle_shape_create); ClassDB::bind_method(D_METHOD("circle_shape_create"), &PhysicsServer2D::circle_shape_create);
ClassDB::bind_method(D_METHOD("rectangle_shape_create"), &PhysicsServer2D::rectangle_shape_create); ClassDB::bind_method(D_METHOD("rectangle_shape_create"), &PhysicsServer2D::rectangle_shape_create);
@ -676,7 +676,7 @@ void PhysicsServer2D::_bind_methods() {
BIND_ENUM_CONSTANT(SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH); BIND_ENUM_CONSTANT(SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH);
BIND_ENUM_CONSTANT(SHAPE_WORLD_MARGIN); BIND_ENUM_CONSTANT(SHAPE_WORLD_MARGIN);
BIND_ENUM_CONSTANT(SHAPE_RAY); BIND_ENUM_CONSTANT(SHAPE_SEPARATION_RAY);
BIND_ENUM_CONSTANT(SHAPE_SEGMENT); BIND_ENUM_CONSTANT(SHAPE_SEGMENT);
BIND_ENUM_CONSTANT(SHAPE_CIRCLE); BIND_ENUM_CONSTANT(SHAPE_CIRCLE);
BIND_ENUM_CONSTANT(SHAPE_RECTANGLE); BIND_ENUM_CONSTANT(SHAPE_RECTANGLE);

View file

@ -220,7 +220,7 @@ public:
enum ShapeType { enum ShapeType {
SHAPE_WORLD_MARGIN, ///< plane:"plane" SHAPE_WORLD_MARGIN, ///< plane:"plane"
SHAPE_RAY, ///< float:"length" SHAPE_SEPARATION_RAY, ///< float:"length"
SHAPE_SEGMENT, ///< float:"length" SHAPE_SEGMENT, ///< float:"length"
SHAPE_CIRCLE, ///< float:"radius" SHAPE_CIRCLE, ///< float:"radius"
SHAPE_RECTANGLE, ///< vec3:"extents" SHAPE_RECTANGLE, ///< vec3:"extents"
@ -231,7 +231,7 @@ public:
}; };
virtual RID world_margin_shape_create() = 0; virtual RID world_margin_shape_create() = 0;
virtual RID ray_shape_create() = 0; virtual RID separation_ray_shape_create() = 0;
virtual RID segment_shape_create() = 0; virtual RID segment_shape_create() = 0;
virtual RID circle_shape_create() = 0; virtual RID circle_shape_create() = 0;
virtual RID rectangle_shape_create() = 0; virtual RID rectangle_shape_create() = 0;

View file

@ -463,8 +463,8 @@ RID PhysicsServer3D::shape_create(ShapeType p_shape) {
switch (p_shape) { switch (p_shape) {
case SHAPE_PLANE: case SHAPE_PLANE:
return plane_shape_create(); return plane_shape_create();
case SHAPE_RAY: case SHAPE_SEPARATION_RAY:
return ray_shape_create(); return separation_ray_shape_create();
case SHAPE_SPHERE: case SHAPE_SPHERE:
return sphere_shape_create(); return sphere_shape_create();
case SHAPE_BOX: case SHAPE_BOX:
@ -490,7 +490,7 @@ void PhysicsServer3D::_bind_methods() {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
ClassDB::bind_method(D_METHOD("plane_shape_create"), &PhysicsServer3D::plane_shape_create); ClassDB::bind_method(D_METHOD("plane_shape_create"), &PhysicsServer3D::plane_shape_create);
ClassDB::bind_method(D_METHOD("ray_shape_create"), &PhysicsServer3D::ray_shape_create); ClassDB::bind_method(D_METHOD("separation_ray_shape_create"), &PhysicsServer3D::separation_ray_shape_create);
ClassDB::bind_method(D_METHOD("sphere_shape_create"), &PhysicsServer3D::sphere_shape_create); ClassDB::bind_method(D_METHOD("sphere_shape_create"), &PhysicsServer3D::sphere_shape_create);
ClassDB::bind_method(D_METHOD("box_shape_create"), &PhysicsServer3D::box_shape_create); ClassDB::bind_method(D_METHOD("box_shape_create"), &PhysicsServer3D::box_shape_create);
ClassDB::bind_method(D_METHOD("capsule_shape_create"), &PhysicsServer3D::capsule_shape_create); ClassDB::bind_method(D_METHOD("capsule_shape_create"), &PhysicsServer3D::capsule_shape_create);
@ -751,7 +751,7 @@ void PhysicsServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer3D::get_process_info); ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer3D::get_process_info);
BIND_ENUM_CONSTANT(SHAPE_PLANE); BIND_ENUM_CONSTANT(SHAPE_PLANE);
BIND_ENUM_CONSTANT(SHAPE_RAY); BIND_ENUM_CONSTANT(SHAPE_SEPARATION_RAY);
BIND_ENUM_CONSTANT(SHAPE_SPHERE); BIND_ENUM_CONSTANT(SHAPE_SPHERE);
BIND_ENUM_CONSTANT(SHAPE_BOX); BIND_ENUM_CONSTANT(SHAPE_BOX);
BIND_ENUM_CONSTANT(SHAPE_CAPSULE); BIND_ENUM_CONSTANT(SHAPE_CAPSULE);

View file

@ -222,7 +222,7 @@ public:
enum ShapeType { enum ShapeType {
SHAPE_PLANE, ///< plane:"plane" SHAPE_PLANE, ///< plane:"plane"
SHAPE_RAY, ///< float:"length" SHAPE_SEPARATION_RAY, ///< float:"length"
SHAPE_SPHERE, ///< float:"radius" SHAPE_SPHERE, ///< float:"radius"
SHAPE_BOX, ///< vec3:"extents" SHAPE_BOX, ///< vec3:"extents"
SHAPE_CAPSULE, ///< dict( float:"radius", float:"height"):capsule SHAPE_CAPSULE, ///< dict( float:"radius", float:"height"):capsule
@ -237,7 +237,7 @@ public:
RID shape_create(ShapeType p_shape); RID shape_create(ShapeType p_shape);
virtual RID plane_shape_create() = 0; virtual RID plane_shape_create() = 0;
virtual RID ray_shape_create() = 0; virtual RID separation_ray_shape_create() = 0;
virtual RID sphere_shape_create() = 0; virtual RID sphere_shape_create() = 0;
virtual RID box_shape_create() = 0; virtual RID box_shape_create() = 0;
virtual RID capsule_shape_create() = 0; virtual RID capsule_shape_create() = 0;