Godot-proposals: Allow getting the KinematicCollision `collider` when colliding with GridMap cells

Created on 2 Jun 2020  路  3Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
A Minecraft-like game which uses lots of GridMap cells.

Describe the problem or limitation you are having in your project:
When the player collides to GridMap cells, KinematicCollision return null when getting properties such as collider.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
GridMap cells could return some value, assuming I'm using StaticBody in the mesh library.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

# Player.gd (KinematicBody)
var collision = get_slide_collision(0) # get collision with some `GridMap` cell
var collider = collision.collider # != null :D

If this enhancement will not be used often, can it be worked around with a few lines of script?:
I think it would be hard to implemment a GridMap from scratch just to add collisions for its cells.

core physics

Most helpful comment

GridMap is not meant for creating games like Minecraft. If you have that many cells, you should be optimizing your meshes by avoiding drawing non-visible faces (at which point you should be creating meshes in code via SurfaceTool).

All 3 comments

GridMap is not meant for creating games like Minecraft. If you have that many cells, you should be optimizing your meshes by avoiding drawing non-visible faces (at which point you should be creating meshes in code via SurfaceTool).

See also the godot_voxel module.

Also I'd suggest a better title for this issue, e.g.
KinematicCollision with GridMap returns null collider

Was this page helpful?
0 / 5 - 0 ratings