summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorfabriceci <fabricecipolla@gmail.com>2021-09-16 12:31:55 +0200
committerfabriceci <fabricecipolla@gmail.com>2021-09-16 12:31:55 +0200
commit04a53f86d0cb914a130003d4f0b3a39861c152c5 (patch)
treebc218a18c51d283f759bb1d846d42da2c8c119be /scene/2d
parenta507a50d16e3f63f427728e50f1b734efe9872be (diff)
Retrieve platform layer from PhysicsServer2D
Diffstat (limited to 'scene/2d')
-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 {