1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

added spring arm node.

This commit is contained in:
QbieShay
2018-05-13 21:27:56 +02:00
parent f3c09b5088
commit bb14ef5623
6 changed files with 293 additions and 3 deletions

View File

@@ -1920,6 +1920,38 @@ void RayCastSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
/////
void SpringArmSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
SpringArm *spring_arm = Object::cast_to<SpringArm>(p_gizmo->get_spatial_node());
p_gizmo->clear();
Vector<Vector3> lines;
lines.push_back(Vector3());
lines.push_back(Vector3(0, 0, 1.0) * spring_arm->get_length());
Ref<SpatialMaterial> material = get_material("shape_material", p_gizmo);
p_gizmo->add_lines(lines, material);
p_gizmo->add_collision_segments(lines);
}
SpringArmSpatialGizmoPlugin::SpringArmSpatialGizmoPlugin() {
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1));
create_material("shape_material", gizmo_color);
}
bool SpringArmSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
return Object::cast_to<SpringArm>(p_spatial) != NULL;
}
String SpringArmSpatialGizmoPlugin::get_name() const {
return "SpringArm";
}
/////
VehicleWheelSpatialGizmoPlugin::VehicleWheelSpatialGizmoPlugin() {
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1));