You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Merge pull request #63161 from PrecisionRender/master
Add `ShapeCast3D` node
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include "scene/3d/position_3d.h"
|
||||
#include "scene/3d/ray_cast_3d.h"
|
||||
#include "scene/3d/reflection_probe.h"
|
||||
#include "scene/3d/shape_cast_3d.h"
|
||||
#include "scene/3d/soft_dynamic_body_3d.h"
|
||||
#include "scene/3d/spring_arm_3d.h"
|
||||
#include "scene/3d/sprite_3d.h"
|
||||
@@ -2540,6 +2541,41 @@ void RayCast3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||
|
||||
/////
|
||||
|
||||
ShapeCast3DGizmoPlugin::ShapeCast3DGizmoPlugin() {
|
||||
const Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape");
|
||||
create_material("shape_material", gizmo_color);
|
||||
const float gizmo_value = gizmo_color.get_v();
|
||||
const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65);
|
||||
create_material("shape_material_disabled", gizmo_color_disabled);
|
||||
}
|
||||
|
||||
bool ShapeCast3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
|
||||
return Object::cast_to<ShapeCast3D>(p_spatial) != nullptr;
|
||||
}
|
||||
|
||||
String ShapeCast3DGizmoPlugin::get_gizmo_name() const {
|
||||
return "ShapeCast3D";
|
||||
}
|
||||
|
||||
int ShapeCast3DGizmoPlugin::get_priority() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ShapeCast3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||
ShapeCast3D *shapecast = Object::cast_to<ShapeCast3D>(p_gizmo->get_spatial_node());
|
||||
|
||||
p_gizmo->clear();
|
||||
|
||||
const Ref<StandardMaterial3D> material = shapecast->is_enabled() ? shapecast->get_debug_material() : get_material("shape_material_disabled");
|
||||
|
||||
p_gizmo->add_lines(shapecast->get_debug_shape_vertices(), material);
|
||||
p_gizmo->add_lines(shapecast->get_debug_line_vertices(), material);
|
||||
|
||||
p_gizmo->add_collision_segments(shapecast->get_debug_line_vertices());
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||
SpringArm3D *spring_arm = Object::cast_to<SpringArm3D>(p_gizmo->get_spatial_node());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user