Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain3DCollision naming inconsistent with Godot's #640

Open
laurentsenta opened this issue Mar 12, 2025 · 1 comment
Open

Terrain3DCollision naming inconsistent with Godot's #640

laurentsenta opened this issue Mar 12, 2025 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@laurentsenta
Copy link
Contributor

Terrain3D version

31bafda

System information

Godot v4.4.stable.mono - macOS Sonoma (14.6.1) - Multi-window, 2 monitors - Metal (Forward+) - integrated Apple M2 Max (Apple8) - Apple M2 Max (12 threads)

Is the issue reproducable in the demo?

Not applicable

Issue description

I want to write something like:

q_ray = PhysicsRayQueryParameters3D.new()
q_ray.from = ...
q_ray.to = ...
q_ray.collision_mask = Globals.MASK_GROUND + Globals.MASK_A + Globals.MASK_B
q_ray.collide_with_bodies = true
q_ray.collide_with_areas = false
q_result = space_state.intersect_ray(q_ray)

# ...

var is_ground = q_result.collider.collision_mask & Globals.MASK_GROUND != 0

But Terrain3D will provoke a error:

Invalid access to property or key 'collision_mask' on a base object of type 'Terrain3DCollision'.

https://terrain3d.readthedocs.io/en/latest/api/class_terrain3dcollision.html#class-terrain3dcollision-property-mask

This means I need to create a special check just for Terrain3D colliders.

Is there a workaround?
Could we rename the fields to match Godot's collision_mask, collision_layer, collision_priority?

Logs

No response

@TokisanGames
Copy link
Owner

TokisanGames commented Mar 12, 2025

You kind of need a special check for Terrain3D anyway, since Godot returns Terrain3DCollision instead of Terrain3D. See
https://terrain3d.readthedocs.io/en/latest/docs/collision.html#physics-based-collision-raycasting

These are already aliased:
terrain.collision_mask as terrain.collision.mask

I'd prefer Godot returned Terrain3D instead of Terrain3DCollision. It used to, when Terrain3D was a monolithic class and handled collision. Perhaps we can have Terrain3D own the static body and the RID and that would give Terrain3D as the collider.

@TokisanGames TokisanGames added the enhancement New feature or request label Mar 12, 2025
@TokisanGames TokisanGames added this to the 1.0 milestone Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants