In-game, stop adding blocks after one block

0
shyam-appymonkeys posted this 16 May 2019

I followed this and tried using EditingVoxels to edit the voxel volumes in-game.

I tried following what you said, but I still ran into the same issue where the voxels just kept creating over the one previously made, making a long voxel stick or a tunnel if removing. Here is the code . From this I am aware that the ray will start from the newly created/removed voxels, since that is where it collides with.

How do you prevent the ray from colliding with the newly built/removed voxels?

My Volumes are set up with a concave mesh collider and Hitbox disabled.

Edit: I figured that in line 201 in my code, if I don't do the pvo.UpdateAllChunks(), it works almost as intended. The new voxels are added/deleted one at a time, but you are not able to see them immediately. You only see them when you let go of the click(that is when the pvo.UpdateAllChunks() is called again). How can I make it visible and not ray-cast hittable?

Edit 2: Gareth fixed it by adding a line in Frame.cs to prevent the mesh collider from updating while the voxels are being added.

Last edited 20 May 2019

1 Comments
Order By: Standard | Newest | Votes
1
GarethIW posted this 16 May 2019

Had a quick glance at your code, I'm probably going to need your project or at least a repro scene as I'm guessing there's a whole lot of setup scene-side that I will need to actually start experimenting and debugging.


Our 137 members have posted 527 times in 128 discussions