summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-16 13:59:32 +0200
committerGitHub <noreply@github.com>2021-09-16 13:59:32 +0200
commitab8d63a56f1dc2aafde0884affd056e76a8cb386 (patch)
tree7e9a8ebd23a3a6592f6795816cd87a5c94870ba1
parentca5c28fed4a367e95f282adc067df7f4b815e309 (diff)
parent04a53f86d0cb914a130003d4f0b3a39861c152c5 (diff)
Merge pull request #52741 from fabriceci/platform-layer-from-physics-server
Retrieve platform layer from PhysicsServer2D
-rw-r--r--scene/2d/physics_body_2d.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 30f012c7aa..1b6dec1119 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1306,11 +1306,7 @@ void CharacterBody2D::_set_collision_direction(const PhysicsServer2D::MotionResu
void CharacterBody2D::_set_platform_data(const PhysicsServer2D::MotionResult &p_result) {
platform_rid = p_result.collider;
platform_velocity = p_result.collider_velocity;
- platform_layer = 0;
- CollisionObject2D *collision_object = Object::cast_to<CollisionObject2D>(ObjectDB::get_instance(p_result.collider_id));
- if (collision_object) {
- platform_layer = collision_object->get_collision_layer();
- }
+ platform_layer = PhysicsServer2D::get_singleton()->body_get_collision_layer(platform_rid);
}
const Vector2 &CharacterBody2D::get_linear_velocity() const {