summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-09 23:34:01 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-09 23:35:34 -0300
commit192a4d7de5c557bdfe83bd180cd603d7e280ebd4 (patch)
tree94ce9779b3f84fbc320ba83624e326d487ca1c04 /scene/3d
parent0de6cba7e7e114f71fabb3dbe02cf260f7d3e2c6 (diff)
Reworked how servers preallocate RIDs, should fix #10970
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;