-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added debug color and draw faces properties for CollisionShape3D #78273
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
5ee86e1
to
39ae326
Compare
@Big-Burden Could you rebase your changes against the |
scene/3d/collision_shape_3d.cpp
Outdated
@@ -152,10 +172,16 @@ void CollisionShape3D::_bind_methods() { | |||
ClassDB::bind_method(D_METHOD("set_disabled", "enable"), &CollisionShape3D::set_disabled); | |||
ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape3D::is_disabled); | |||
ClassDB::bind_method(D_METHOD("make_convex_from_siblings"), &CollisionShape3D::make_convex_from_siblings); | |||
ClassDB::bind_method(D_METHOD("set_debug_color", "color"), &CollisionShape3D::set_debug_colour); | |||
ClassDB::bind_method(D_METHOD("get_debug_color"), &CollisionShape3D::get_debug_color); | |||
ClassDB::bind_method(D_METHOD("set_debug_draw_faces", "bool"), &CollisionShape3D::set_debug_draw_faces); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClassDB::bind_method(D_METHOD("set_debug_draw_faces", "bool"), &CollisionShape3D::set_debug_draw_faces); | |
ClassDB::bind_method(D_METHOD("set_debug_draw_faces", "debug_draw_faces"), &CollisionShape3D::set_debug_draw_faces); |
Match the argument
scene/resources/box_shape_3d.cpp
Outdated
@@ -29,6 +29,8 @@ | |||
/**************************************************************************/ | |||
|
|||
#include "box_shape_3d.h" | |||
|
|||
#include "primitive_meshes.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "primitive_meshes.h" | |
#include "scene/resources/primitive_meshes.h" |
Full paths are used here
scene/resources/shape_3d.cpp
Outdated
Ref<ArrayMesh> Shape3D::get_debug_mesh() { | ||
if (debug_mesh_cache.is_valid()) { | ||
return debug_mesh_cache; | ||
Ref<ArrayMesh> Shape3D::get_debug_mesh(const Color& p_debug_color, const bool p_with_shape_faces) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref<ArrayMesh> Shape3D::get_debug_mesh(const Color& p_debug_color, const bool p_with_shape_faces) { | |
Ref<ArrayMesh> Shape3D::get_debug_mesh(const Color& p_debug_color, bool p_with_shape_faces) { |
No const
for simple types, and match header
scene/resources/shape_3d.h
Outdated
virtual Vector<Vector3> get_debug_mesh_lines() const = 0; // { return Vector<Vector3>(); } | ||
virtual Ref<ArrayMesh> get_debug_face_mesh(const Color p_vertex_color) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual Ref<ArrayMesh> get_debug_face_mesh(const Color p_vertex_color) const; | |
virtual Ref<ArrayMesh> get_debug_face_mesh(const Color &p_vertex_color) const; |
Pass by reference
scene/resources/sphere_shape_3d.cpp
Outdated
@@ -30,6 +30,7 @@ | |||
|
|||
#include "sphere_shape_3d.h" | |||
|
|||
#include "primitive_meshes.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "primitive_meshes.h" | |
#include "scene/resources/primitive_meshes.h" |
@@ -30,6 +30,7 @@ | |||
|
|||
#include "world_boundary_shape_3d.h" | |||
|
|||
#include "mesh.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "mesh.h" | |
#include "scene/resources/mesh.h" |
@@ -46,6 +46,7 @@ class WorldBoundaryShape3D : public Shape3D { | |||
const Plane &get_plane() const; | |||
|
|||
virtual Vector<Vector3> get_debug_mesh_lines() const override; | |||
virtual Ref<ArrayMesh> get_debug_face_mesh(const Color p_vertex_color) const override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual Ref<ArrayMesh> get_debug_face_mesh(const Color p_vertex_color) const override; | |
virtual Ref<ArrayMesh> get_debug_face_mesh(const Color &p_vertex_color) const override; |
dbe187d
to
6272ee1
Compare
…3D of primitive shapes
6272ee1
to
3ce21a5
Compare
I actually spent this past week adding this very feature with the intention of creating a pull request, without realising this already exists. No idea how I didn't find this when I searched for it. In any case, I'm just going to link my branch here instead of opening a pull request for the moment. It includes support for all Shape3D resources, including height maps, convex, and concave collision surfaces. If @Big-Burden wants to use any of that to add to this, feel free. I am currently using this branch for my own game, so I'll be continuing to maintain it for the foreseeable future. |
Feel free to post a pull request so we can check its merits. |
Since #90644 was merged in, perhaps this should be closed? |
Superseded by #90644 |
Partially closes godotengine/godot-proposals/issues/906
Currently does not support drawing faces for HeightMap, Concave or Convex Shapes
