godot icon indicating copy to clipboard operation
godot copied to clipboard

Godot 3.0 KinematicBody2D with CollisionShape2D reports no collisions against StaticBody2D with CollisionShape2D

Open rubenjavier opened this issue 9 years ago • 8 comments

I dont know if in the refactoring of Godot 3.0 collisions are still a WIP, if this is the case, please ignore this

Operating system or device - Godot version: Windows 10 Home 64bits Godot 3.0 VS 2013

Issue description: a simple KinematicBody2D with any CollisionShape2D and a gravity applied to it on its func _process(delta): goes right trough a StaticBody2D with a CollisionShape2D without reporting "is_colliding"

Steps to reproduce:

  1. create a KinematicBody2D
  2. add a CollisionShape2D (a rectangle of 10x10 would do) as a child of the KinematicBody2D
  3. create a StaticBody2D and place it bellow the KinematicBody2D (500px would do)
  4. add a CollisionShape2D (a rectangle of 100x10 would do) as a child of the StaticBody2D
  5. add some gravity in the _process(delta) E.g.:
var speed_y = 0
func _ready():
 set_process(true)

func _process(delta):
  speed_y += 100 * delta
  move(Vector2(0,speed_y))
  if is_colliding():
    print("collision")
  pass

(Bugsquad edit: fixed formatting)

rubenjavier avatar Feb 13 '17 20:02 rubenjavier

Can you confirm that this issue isn't present in 2.x? Also, does it still happen with _fixed_process? Finally, your StaticBody2D isn't a child of your KinematicBody2D, I presume...

bojidar-bg avatar Feb 14 '17 09:02 bojidar-bg

sorry I worte _process(delta): instead of _fixed_process(delta):, but the Bug is still the same: .-in 2.x collisions are very imprecise on _process(delta): .-in 3.0 it still happens if I mode the code to _fixed_process(delta): .-my StaticBody2D (ground) is not a child of KinematicBody2D (player)

thanks in advance

rubenjavier avatar Feb 14 '17 12:02 rubenjavier

Tested on a build that is more than a week old...

Put a rigid body over the kinematic, you will see it colliding on the original kinematic position, looks like the shape is not updated, happens with position too and affects all the bodies and polygon shapes too.

I guess that the physics server is too unstable to do anything yet.

eon-s avatar Feb 14 '17 14:02 eon-s

@bojidar-bg this is still tagged as "need testing", I think it should be tagged "confirmed", as it has been replicated by many, so it can be assigned to someone.

This makes the 2D framework almost unusable in its current state for most types of 2D games.

Thanks

rubenjavier avatar Feb 17 '17 16:02 rubenjavier

Hm, I'm absolutely sure I tagged it as such, but seems thing went wrong somehow..

bojidar-bg avatar Feb 17 '17 17:02 bojidar-bg

Thanks

rubenjavier avatar Feb 17 '17 17:02 rubenjavier

Testing with a new build shows this is fixed from https://github.com/godotengine/godot/pull/7963

NullNeska avatar Mar 06 '17 15:03 NullNeska

Nice!

akien-mga avatar Mar 06 '17 15:03 akien-mga