Skip to content

KinematicCollision3D.get_local_shape() always returns only the zero index shape #75069

Closed
@viksl

Description

@viksl

Godot version

4.0 dotnet

System information

Windows 10, Nvidia GTX 1660Ti, Vulkan

Issue description

I'd first like to say I'm not sure if this is a bug or if I'm just understanding the functionality wrong, I've been trying reddit, discord for days, nothing so I decided to come with it here.

I'd like to get the collision shape which collided during KinematicCollision from inside a CharacterBody3D, I found there's get_local_shape(index) method but this method always returns only the 0 index CollisionObject.

If I'm using this wrong I'm sorry, is there some way to use this or something else to get the particular colliding shape?

Test project is in gdscript.

Thank you.

Steps to reproduce

  1. Play the project
  2. Wait until objects collide
  3. Read the output, it prints the first shape only (ChracterBodyShape1)
    The local_shape_at_index prints the shape that should be colliding but it returns only the 0 index CollisionShape3D which is named CharacterBodyShape1, the shape which collided is CharacterBodyShape2
  4. Stop the project
  5. Move the CharacterBodyShape2 above CharacterBodyShape1 in the sceen tree so it's the first child of the CharacterBody3D node.
  6. Play the project
  7. Watch the Output again (again only the first shape this time ChracterBodyShape2 since you moved it up)

As you can see now it prints the colliding shape but only because it's the 0 index shape.

Minimal reproduction project

TestGetLocalShape.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions