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

How to edit terrain in game with raycast. #727

Open
tobyplowy opened this issue Feb 1, 2025 · 1 comment
Open

How to edit terrain in game with raycast. #727

tobyplowy opened this issue Feb 1, 2025 · 1 comment
Labels

Comments

@tobyplowy
Copy link

tobyplowy commented Feb 1, 2025

please describe your setup:

  • Terrain type blocky
  • Godot version most recent

I'm sorry to open an issue for something as basic as this. I have been reading the documentation for a while now but just can't seem to find it I also downloaded the sample vowel game project but that didn't make sense. It was a bit too complicated for me.

But basically I'm trying to just get the position of the block I'm looking at with a raycast on my camera and ether remove the block I'm looking at or place a block where I'm looking.

I just can't seem to find how to actually edit the terrain.

Sorry for the dumb question.
Ps you may wanna make the info for this more accessable in the documentation unless I'm just too dumb and looked past it hehe

So I have a basic fps player with a camera and a raycast on that camera. How would I use the raycast to place or remove a block?

@Zylann
Copy link
Owner

Zylann commented Feb 1, 2025

The doc shows how to use voxel raycasting here, using VoxelTool: https://voxel-tools.readthedocs.io/en/latest/blocky_terrain/#raycast
As for editing what is pointed at, see other functions of VoxelTool.

Another example can be found here: https://github.com/Zylann/voxelgame/tree/master/project/blocky_terrain
In this script: https://github.com/Zylann/voxelgame/blob/77c6389bc91c9eeb522ccc924b1007a31850266f/project/blocky_terrain/avatar_interaction.gd#L52

You can also ask on Discord linked on the Readme.

@Zylann Zylann added the question label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants