Skip to content

Collision indices #230

@ScriptLineStudios

Description

@ScriptLineStudios

I think it would be great to have some sort of mechanism which can tell you which index in an array of colliders your ray interested with. This could, for example be useful in raycasting games perhaps to differentiate between multiple different wall textures or determine if a ray hit a wall or an enemy.

As for how this api could be implemented, there are probably a couple ways to go about it, for example:

raycast(line, colliders) -> ((x, y) | None), (index | None)

Alternatively to avoid modifying existing api, we could introduce something along the lines of raycast_with_index

raycast(line, colliders) -> (x, y) | None
raycast_with_index(line, colliders) -> ((x, y) | None), (index | None)

With either option, the same would be needed for multiraycast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions