|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Cameron Kilgore |
On a KinematicBody object, I use a conditional on is_colliding() to check if my object is on the floor prop (or a mesh, in general). Since is_colliding() is no longer supported, what methods can I use in its place to return a boolean when my KinematicBody is on the surface of a mesh?
|
|
|
|
Reply From: |
SIsilicon |
There are 4 methods that can be used
is_on_floor()
is_on_wall()
is_on_ceiling()
move_and_collide()
The first three return a boolean and the conditions they each test is self explanatory.
Note: they need to be updated for sensible values with move_and_slide()
at least once per frame.
The last one however works just like move_and_slide
Except it returns a kinematic collision if there is a collision you can test if what it returns is a kinematic collision. If not, there is no collision.
|
|
|
|
Reply From: |
eons |
Check the demos (like platformer) and/or the documentation
The move methods give you access to a KinematicCollision object that store the state of the collision if there is any or null otherwise, in the case of move_end_slide
, the result of of get_slide_count
will be > 0.