Open dcmrobin opened 1 year ago
The second one, meaning the one I suggested? Yeah, I'll try... I've just got to figure out a way of detecting (from the log.cs script) what face the log is being placed on.
Edit: I've made a way for the buildmeshfaces method to get the placed block: Now I just need to detect which face the block is being placed on
Do you have any idea how to detect which block the player is looking at? If I got that, then I might be able to get the face of that block when a block is placed, and then put that into the if statement in the picture above.
Hmm. The only way that comes to mind right now is by taking advantage of the rotation angle of the camera; if you determine the player is looking down, you're placing a block on top of another one - if you're looking up, bottom face, and, for the remaining faces, you could determine what cardinal direction the player's looking towards: North, South, East or West.
that's a good idea... yeah now that I think of it, that would work!
I have an idea for the ambient lighting in caves problem: when you get to a certain y-level, the skybox changes, or all ambient lighting gets taken away. another way is to check if there's only air above the player... but that wouldn't work as you going under a tree would get rid of ambient lighting, and also you could light up an entire cave by just standing under a hole in the roof of it. let me know if you have any ideas as well!
Oh, I've got it! You very helpfully implemented a variable called "Baselandheight" or something like that to help place trees on the ground. If I had the ambient lighting go away as soon as the player goes below that value!
Sadly I found that the baslineLandHeight var is only assigned and accessible in the function of terraingenerator.cs that runs through the blocks and makes them grass, rock, etc. that means it can only be used when the chunk is generated or regenerated.
Hey!
Correct. It is only used to decide where to start placing trees, if I remember correctly.
Three good ways to determine if a player is inside a cave or not could be:
I'll take a look at how Minecraft actually does this, I'm really curious. Hopefully this helps someway!
Thanks a lot for the response and those are some great replies! I got the idea for checking if below ground from a Minecraft video, that, when the player dug underground the skybox changed color, and then when the player got back above ground the skybox was light again.
I could also (as a temporary fix) I could have the ambient light go away once the player reaches a low y-value. (one that couldn't be reached above ground)
Hi! I discovered your Minecraft clone a long time ago and downloaded it. I've been working on my version ever since, and was wondering if you could check it out! https://github.com/dcmrobin/UnityMinecraft