Тёмный

Raycasting Through Slabs, Stairs, and More! 

Cloud Wolf
Подписаться 33 тыс.
Просмотров 8 тыс.
50% 1

We cover a system for making raycasts go through partial blocks where there is air.
📦 Download: www.dropbox.co...
🔵 Discord Server: (See channel about page)
💻 Website: cloudwolfyt.gi...
🐺 Twitter: / cloudwolfbane
Music:
"Werq" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
All Songs Used under fair copyright. Lincenses Below:
License for commercial use: Creative Commons Attribution 4.0 Unported "Share Alike" (CC BY-SA 4.0) License.
Full License HERE - creativecommon...

Опубликовано:

 

6 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 54   
@arnoldgrunwald3989
@arnoldgrunwald3989 2 года назад
i tried to do this too but gave up on the stairs bc of the many variants. your system is also way more efficient so thank you for that :D
@mika34653
@mika34653 2 года назад
That's cloud wolf for you
@SilicatYT
@SilicatYT 2 года назад
You're a life-saver! Luckily I did all the blocks that can't use your system either way first 👀 Would've been painful otherwise
@TheiBunny
@TheiBunny Год назад
THANK YOU SO MUCH FOR THIS!!! Was super hesitant to even start a bunch of packs I wanted to make that required being able to detect *exactly* what block a player was looking at (same result as F3's "looking at:") when they used an item - since I knew it meant having to account for every possible orientation and state of every non-full-block model to make exceptions for, which I thought would be way too involved for what's only meant to be a simple function... but the transformation matrices solution and how you've ordered the checks to minimize the total number of block checks is a stroke of genius.
@olillin
@olillin 2 года назад
Oh I remember really wanting to know this!
@lehanniehaus9889
@lehanniehaus9889 2 года назад
Using the rotation matrixes is a GENIUS idea!
@Magnogen
@Magnogen 2 года назад
When you said doors, I thought you were gonna do something interesting, like fire through the holes on an oak door, or an acacia door. I never even realised if the door was open or not!
@Cl0udWolf
@Cl0udWolf 2 года назад
u could add that functionality if u wanted but that would be dependent on the door shape / type /texture and not the actual hitbox of the door
@ancientpixel9809
@ancientpixel9809 2 года назад
This is absolutely amazing! Never thought I'd see transformation matrices outside school! I don't know wheather this makes sense, but I've just had an idea how to make this even more percise. If you could dynamically adjust the step size somehow, you'd be able to do your normal raycast at a stepsize of like .5, but as soon as it enters one of your partial blocks, it steps back by .5 and then continues with a stepsize of .1 for the next one block. This way, you could reduce the load (because the small step size is not really needed when just figuring out what block the ray is in) but keep all the percision (because it knows exactly where it is inside the block if it really matters). Because everything is happening in one tick anyways, the different speeds wouldn't matter. But I don't know if the additional logic for such a system would maybe produce more load than is saved by the larger average stepsize... Anyway, great video and a really creative solution!
@Cl0udWolf
@Cl0udWolf 2 года назад
dynamic step size becomes a lot of extra commands that is a bit unnecessary
@404waffles
@404waffles 2 года назад
transformation matrices are everywhere in graphics programming lol
@ranger2671
@ranger2671 2 года назад
Thank you! I have been trying to figure this out for a while!
@LegoBro
@LegoBro 2 года назад
I used a very similar method when I made my video a couple years ago on this. However, instead of storing the decimal version of the block, I just used 16 as the multiplier and modulus operations. That way the values were pixel perfect and super easy for me to mentally map and figure out. Of course that's assuming you stayed with 16x16 models and weren't doing something fancy with custom models. I also set my step size to be 1/16th of a block as well, which might not be efficient, but it got really nice feeling hitboxes for my maps.
@Cl0udWolf
@Cl0udWolf 2 года назад
using steps of 16 means nothing unless ur raycast step size is < 1/16th, as I stressed a lot in the video the bounding boxes will depend on the raycast step size. If you have something 3/16th for say a door edge, and your raycast is 1/4, or 4/16th then your system would potentially let a raycast travel through a solid door if the player stands at a certain location.
@jabberjerry
@jabberjerry 2 года назад
Yo I was just about to comment that I had seen this all before and here you were! I actually recreated your method for my server, so thank you for making my game better! I like the mod16 better as well haha
@LegoBro
@LegoBro 2 года назад
@@Cl0udWolf That's what I meant, the raycast itself was at 1/16 of a block per step.
@Cl0udWolf
@Cl0udWolf 2 года назад
@@LegoBro as I said in the video doing 16th step is more logical but u need to use what makes sense for step size and for me I use either 1/4 or 1/2 just for lower command counts especially with like a sniper. I discussed all that in the video
@LegoBro
@LegoBro 2 года назад
Yeah, in terms of efficiency, that definitely makes sense. It depends on what else you have running and how many of them. With guns raycasts really only last one tick, so I went with the more expensive route. But for stuff that constantly runs every tick, definitely makes sense to go with larger steps.
@maxg971
@maxg971 2 года назад
I love your videos so much bc theyre (at least somewhat) easy to understand, you dont seem to leave anything out and I always get a million more ideas of wha to code after watching them (and you also just seem to be a rly nice guy) thats why I come to you with my dilemma: I have so many ideas for stuff, its only ever increasing and I think its getting to a point where modding would just make more sense. but I already sank months into learning the datapack stuff and working on one and I feel like switching to modding now would waste that (I know that all the textures and ideas wont go to waste, but still) what should I do
@Cl0udWolf
@Cl0udWolf 2 года назад
Just use whatever u like working with most
@yoavsigler4457
@yoavsigler4457 2 года назад
This is just beautiful
@Cl0udWolf
@Cl0udWolf 2 года назад
glad u appreciate it :)
@BigVirusBoi
@BigVirusBoi 2 года назад
very nice
@swegatron2859
@swegatron2859 Год назад
There's one kind of raycasting that doesn't require you to account for weirdly shaped blocks, looking_at predicates already account for line of site through the blocks actual hitbox, so you can iteratively tp a hitbox (i use a tagged invisible nogravity arrow) away from the player until predicate looking_at is false, idk why its not a more common method bcs its almost as simple, its best for short distances since it requires the player to keep looking during the milliseconds that it takes to find a block that'll obstruct line of sight, but still very underated
@Cl0udWolf
@Cl0udWolf Год назад
First off ur understanding of time doesn’t make any sense. Second, it is something ppl use. Third, this is mainly intended for systems like guns, and trying to use looking at predicate for a gun and adding random spread and recoil is a big problem
@swegatron2859
@swegatron2859 Год назад
@@Cl0udWolf yeye I’m not bashing this method at all, its great I use it quite often, & this tutorial is great. Im just saying specifically when it comes to getting around the irregular shaped block hitbox issue, a looking_at predicate with an invisible tracer is incredibly simple & few ppl know about it
@Cl0udWolf
@Cl0udWolf Год назад
@@swegatron2859 there r plenty of limitations to looking at, tho I would imagine ppl don’t know about it because it requires datapacks and u need to make json files
@arwenfails5883
@arwenfails5883 2 года назад
Is it just me or are you slowly getting more and more blue
@Cl0udWolf
@Cl0udWolf 2 года назад
see my vid for TeamSeas XD
@colevilleproductions
@colevilleproductions 2 года назад
I just realized that I actually understood the contents of this video I just realized that I actually spoke way too soon
@sheepcommander_
@sheepcommander_ 2 года назад
loll
@djrobotzz
@djrobotzz Год назад
wait so, can you explain this to me for the stairs, why would you set the #bool score to 0 if the stair type is top? wouldnt it just completely erase all the previous checks? Like if it is top it won't set the .itt to 0 right? or does it do something else which makes it remember the previous stuff?
@djrobotzz
@djrobotzz Год назад
o wait nvm, i just didnt think about it correctly. You are looking at whether the player is raycasting into the top/bottom of the block. Just like all the other things
@Cl0udWolf
@Cl0udWolf Год назад
I use some advanced logic here to minimize block checks and command count, sometimes I use if sometimes unless logic
@djrobotzz
@djrobotzz Год назад
yeah i noticed that. I spent the last 2 hours or so coding away and giving nearly every block its own hitbox! I did the big dripleaf, carpets, daylight detectors, doors, end portal frames, fence gates, fences (also iron bars and glass panes, they all work the same), slabs, snow layers, stairs, trapdoors, walls and a few other blocks! (The reason i did SOO many blocks is because once the raycast hits the ground it summons a spear thingy, just like you would see an arrow in the ground). But i couldnt have done it without this tutorial so thanks!
@Cl0udWolf
@Cl0udWolf Год назад
@@djrobotzz sounds cool, getting the hitboxes for each block can be tricky especially ones with many states
@djrobotzz
@djrobotzz Год назад
@@Cl0udWolf it definitely was! But the stairs were by far the hardest with its block states, and you already made them! The fences and walls were also a little difficult but as i knew what i had to do i didnt struggle much
@MrBlackLide
@MrBlackLide 2 года назад
Amazing work, good job ! I am myself making a minecraft Zelda like, I guess you’re pretty busy with all your plans. In case you’re willing to work on a project or do you know anyone who’s available to work on a new project? I really need some help 😅 Thank you !
@Cl0udWolf
@Cl0udWolf 2 года назад
U can get some help from the discord but not direct
@MrBlackLide
@MrBlackLide 2 года назад
​@@Cl0udWolf Thanks for the answer! You mean the "Command Discord Server"? I am even prepared to pay for the work done, but I would just have to find someone available.
@Cl0udWolf
@Cl0udWolf 2 года назад
@@MrBlackLide I meant mine
@MrBlackLide
@MrBlackLide 2 года назад
@@Cl0udWolf Oh great, thank you so much! I totally understand that you don’t have time to deal with it right now, I don’t plan to release the video game right away anyway. I’m sending you a discord message then. Thanks again!
@art_tale
@art_tale 2 года назад
Now try doing bamboo
@deletechannel3776
@deletechannel3776 2 года назад
I think fences/walls will be enough for this one...
@art_tale
@art_tale 2 года назад
@@deletechannel3776 actually bamboo and flowers are randomly offset depending on the world cords. So their hitboxes will be different each time. Unlike fences that are always located in the middle of block. You have to recalculate the random offset with bitwise operations first. It would be quite a bit of work to get this working
@deletechannel3776
@deletechannel3776 2 года назад
@@art_tale i know...but bamboo does not go on the very edge of the block...it still sits somewhere in the middle...right?
@art_tale
@art_tale 2 года назад
@@deletechannel3776 it can go the edges of the blocks. And you can completely miss the bamboo or get false positives when not looking at the bamboo part of the block
@le3lux
@le3lux 2 года назад
First XD
@cahydra
@cahydra 2 года назад
why am i watching this?
@sheepcommander_
@sheepcommander_ 2 года назад
why not? It great