0 votes

I have a Player placed in the scene:

extends KinematicBody

func _ready():
    collision_layer = 3

and a Projectile which is instantiated via script:

extends KinematicBody

func _init():
    collision_layer = 2

Player uses moveandslide and Projectile uses moveandcollide to get around.

I expect them not to collide since their collision_mask is 1 by default and they are on layer 2 and 3, but whenever a Projectile is instantiated (at the Player's position), it causes a spaz to the Player's position, which I assume is a collision between them.

I create the collision shape for the Projectile programmatically, without changing anything:

var collision_shape = CollisionShape.new()
collision_shape.shape = SphereShape.new()
self.add_child(collision_shape)

And for the Player I set it in the editor to a CapsuleShape, without changing anything as well.


I am using v3.2.stable.official (Steam).

asked Feb 2 in Engine by aron137 (16 points)

It seems only moveandslide (Player) detects collision, moveandcollide (Projectile) does not.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.