summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/light.cpp8
-rw-r--r--scene/3d/physics_body.cpp2
2 files changed, 8 insertions, 2 deletions
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 02d10523e7..389d87cd90 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -255,7 +255,13 @@ void Light::_bind_methods() {
Light::Light(VisualServer::LightType p_type) {
type = p_type;
- light = VisualServer::get_singleton()->light_create(p_type);
+ switch (p_type) {
+ case VS::LIGHT_DIRECTIONAL: light = VisualServer::get_singleton()->directional_light_create(); break;
+ case VS::LIGHT_OMNI: light = VisualServer::get_singleton()->omni_light_create(); break;
+ case VS::LIGHT_SPOT: light = VisualServer::get_singleton()->spot_light_create(); break;
+ default: {};
+ }
+
VS::get_singleton()->instance_set_base(get_instance(), light);
reverse_cull = false;
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index bc089e5b41..4e06b272e2 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -995,7 +995,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
Transform gt = get_global_transform();
gt.origin -= collision.travel;
set_global_transform(gt);
- return floor_velocity;
+ return floor_velocity - p_floor_direction * p_floor_direction.dot(floor_velocity);
}
} else if (collision.normal.dot(-p_floor_direction) >= Math::cos(p_floor_max_angle)) { //ceiling
on_ceiling = true;