Тёмный
No video :(

Easy Bullet Holes (Godot Decal Tutorial) 

Garbaj
Подписаться 460 тыс.
Просмотров 30 тыс.
50% 1

How to make bullet holes, the easy way, in Godot.
FPS controller tutorial: • Improved First Person ...
Buy me a coffee: ko-fi.com/garbaj
-- Social --
Discord: the discord server has been shut down, sorry!
Twitter: / garbaj2
-- Links --
Website: garbaj.net
Github: github.com/Gar...

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

 

23 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 179   
@CrtngSomethings
@CrtngSomethings 3 года назад
A little tip: Making the bullet holes big and adding foggy dust and stone particles can make it look like those from F.E.A.R
@garbaj
@garbaj 3 года назад
true true
@lethn2929
@lethn2929 Год назад
For anyone looking at this in 2023, Godot 4 now has real decal nodes available and it makes it much easier to implement the bullet holes now without too much fancy maths. You need to rotate the decal node specifically ( Parent rotation doesn't seem to do the trick properly for some reason ) and then follow the tutorial along as normal and it should all work fine. As others have mentioned in the comments, to deal with any stretching issues, make sure to add the decal to the root rather than as a child of the raycasted collider.
@MagicMaskedMonkey
@MagicMaskedMonkey Год назад
how do i do that?
@ezyyy69
@ezyyy69 8 месяцев назад
aight mate thanks ❤
@bluething3D
@bluething3D 2 месяца назад
Thank you! Ive been trying to get the decal to work and this might be the trick
@CROXoDyLE
@CROXoDyLE Год назад
For those wondering how to make the decals work on slopes/ground: func check_collision(): if raycast.is_colliding(): var collider = raycast.get_collider() var b = b_decal.instance() # if collider.is_in_group("Enemies"): # collider.queue_free() # print("killed " + collider.name) # get_tree().get_root().add_child(b) ## **this line preserves scale of decal too! ** b.global_transform.origin = raycast.get_collision_point() var surface_dir_up = Vector3(0,1,0) var surface_dir_down = Vector3(0,-1,0) if raycast.get_collision_normal() == surface_dir_up: b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.RIGHT) elif raycast.get_collision_normal() == surface_dir_down: b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.RIGHT) else: b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.DOWN)
@kaliss6110
@kaliss6110 Год назад
thank you man so much
@oddstap6976
@oddstap6976 Год назад
Thank you so much
@testtesttesttest-ty5mk
@testtesttesttest-ty5mk Год назад
tysm, i had i way to complicated way to preserve scale, this is so much simpler :]
@UnknownGamer40464
@UnknownGamer40464 10 месяцев назад
Thanks a lot for this, was kinda annoyed it showed up sideways on the flat ground
@bluething3D
@bluething3D 2 месяца назад
this line "get_tree().get_root().add_child(b)" was so helpful. Thank you!
@2nafish117
@2nafish117 3 года назад
you can also tween the alpha transparency of the bullet hole before it disappears so it disappears gradually. really simple way to do bullet decals, nice tut. EDIT: also if you have a normal map texture for the bullet hole, it will look like it has depth.
@garbaj
@garbaj 3 года назад
Good tip! Glad you liked the tutorial
@sundownsau
@sundownsau 3 года назад
Do you have an example of tweening a material's alpha like this? I have a scene just like the video and am trying to tween the mesh's material's albedo_color.a value, but the tween doesn't seem to be executing (and I remembered to start it!). The _ready function on my decal's script looks like this: tween.interpolate_property(mesh_instance.get_surface_material(0), "albedo_color.a", 1, 0, 1.0, Tween.TRANS_LINEAR) tween.start() If i print the alpha in the _process function it stays and 1 and my Tween node's is_active function is returning false. Am I missing something here??
@danylbekhoucha6180
@danylbekhoucha6180 3 года назад
@@sundownsau in the string replace . by : albedo_color:a It's for every settings. translate.x becomes translate:x
@sundownsau
@sundownsau 3 года назад
@@danylbekhoucha6180 Lifesaver mate, thank you so much! Glad I didn't spend too long trying different things because I would not have figured that one out by trial and error :p
@thechaxxe3565
@thechaxxe3565 3 года назад
@@sundownsau can I see all your code? I've been working on the same thing for 5+ hours and cannot figure out how to fade things correctly, especially the part about getting the albedo_color in my tween
@Julius-rx1dx
@Julius-rx1dx 2 года назад
Fix for Floors and cealing: var surface_direction_up = Vector3(0, 1, 0) var surface_direction_down = Vector3(0, -1, 0) if raycast.get_collision_normal() == surface_direction_up: b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.RIGHT) elif raycast.get_collision_normal() == surface_direction_down: b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.RIGHT) else: b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.DOWN)
@Beanthemostgrenn
@Beanthemostgrenn 2 года назад
thank you sooooo much!
@alextkd2003
@alextkd2003 Год назад
@@Beanthemostgrenn I just posted a comment about it
@RandomEH
@RandomEH Год назад
Thought I would point out your surface_direction variables are just Vector3.UP and Vector3.DOWN
@PRO1OO
@PRO1OO Год назад
Thank you VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!
@bluething3D
@bluething3D 2 месяца назад
this worked, thank you so much!
@pascalcasier959
@pascalcasier959 3 года назад
Once again thank you so much for all those great videos. Keep up the good job.
@garbaj
@garbaj 3 года назад
Thanks, will do
@Wodsobe
@Wodsobe 3 года назад
Dang, this will help with a lot of stuff, thanks!
@garbaj
@garbaj 3 года назад
Always happy to help
@danylbekhoucha6180
@danylbekhoucha6180 3 года назад
Nice tutorial, I was stuck to convert the normal to an angle and the solution was the look_at. Note that Godot 4.0 has a decal node, it works on rounded surfaces. I suggest a tutorial on doing math with current ammo and ammo in pack remaining. For example if you have 1/2 after reloading you should have 3/0 and be unable to reload.
@garbaj
@garbaj 3 года назад
Been thinking about doing something along those lines
@bluething3D
@bluething3D 2 месяца назад
Very helpful! this along with the comments got my decals working perfectly
@Skormie
@Skormie 3 года назад
Amazing tutorial straight to the point no fluff. Love it subscribed!
@doctormustaqueem2005
@doctormustaqueem2005 3 года назад
Very easy to understand Please make a demo on 'muzzle flashes'....
@garbaj
@garbaj 3 года назад
Hopefully coming soon!
@abelhernandez9405
@abelhernandez9405 3 года назад
This would be a great way to program sprays/tags like in CSGO or Overwatch.
@MokarromHossain
@MokarromHossain 3 года назад
Prediction : After 1 year Garbaj will have all the tutorials we need to make a fully functional Fortnite , PUBG , Free Fire , GTA 5 , anything
@garbaj
@garbaj 3 года назад
we're getting there!
@salarycat
@salarycat 3 года назад
Very good tips thanks. I think typing the code is in general more easily understandable than pasting it. Or it could be my personal taste.
@HonsHon
@HonsHon 3 месяца назад
For those of you using Godot 3.x, RayCasts are actually not necessarily needed (although they may still be preferred). You can follow this same method, but use the KinematicCollision gathered from the collision with the same results (at least from what I have tested). Of course, this only applies to objects that actually tie into Godot's physics system. You cannot project these decals from a camera using KinematicCollisions. Here is the method: -------------------------------------------------- # Grab the KinematicCollision from move_and_collide() (or move_and_slide by iterating through the slides) var collider : KinematicCollision = move_and_collide(velocity * delta) # KinematicCollisions give you the same info a RayCast collision will give you if collider != null || collider.collider != null: var b = BulletDecal.instance() collider.collider.add_child(b) b.global_transform.origin = collider.position b.look_at(collider.position + collider.normal, Vector3.UP) --------------------------------------------------
@slickback5100
@slickback5100 Год назад
Oh my god, I have been trying to find out how to make a texture background transparent as a .png for the past few days. It's been bothering the hell out of me. Didn't come for that but I'm glad I found it here.
@klaatubarada6200
@klaatubarada6200 2 года назад
Thank you! Just what I need
@rv178
@rv178 3 года назад
You never cease to impress me.
@Anomal0
@Anomal0 3 года назад
yo, the bullet holes dont work with maps made with csg combiner, some subtracted parts will return a normal of (0, 1, 0) causing the bullet to stand still in the raycast point, can u find a way to fix that plz, to replroduce make a csg map and make a hole somewhere with subtract thing and test the bulletholes
@pavelmatusu4457
@pavelmatusu4457 3 года назад
The same thing happened to me and only if the surface was perfectly facing upwards so i fixed it like this: if raycast.get_collision_normal() == Vector3(0,1,0) or raycast.get_collision_normal() == Vector3(0,-1,0): bullet_hole.look_at(raycast.get_collision_point() + raycast.get_collision_normal(),Vector3(1,0,0)) else: bullet_hole.look_at(raycast.get_collision_point() + raycast.get_collision_normal(),Vector3.UP)
@chowderhound
@chowderhound 3 года назад
@@pavelmatusu4457 thanks king
@eduardosanchezbarrios5810
@eduardosanchezbarrios5810 3 года назад
Nice tutorial 👍👍👍 AND love the Spas-12 shotgun model
@garbaj
@garbaj 3 года назад
Glad you like it
@thesandvichguy6331
@thesandvichguy6331 3 года назад
Thank you I have been looking for this.
@garbaj
@garbaj 3 года назад
Glad to help
@vsevolod_pl
@vsevolod_pl 3 года назад
Thank you very much! I had a lot of problems with decal rotation.
@vsevolod_pl
@vsevolod_pl 3 года назад
But now i have a problem with cylinders
@Mautar55
@Mautar55 3 года назад
Something to consider! If you shoot on a curved surface it obviously won't bend. Same as for the edges of flat surfaces!
@garbaj
@garbaj 3 года назад
You're right, and that's why we're all waiting for 4.0
@Mautar55
@Mautar55 3 года назад
@@garbaj It can be improved, still. Some special shader could be made that avoids drawing over the background and checks over the distance to blend properly. But that is a lot of work.
@kalelojed3109
@kalelojed3109 2 года назад
That's cool and all but how do you make it face the floor or ceiling?
@jammy3662
@jammy3662 2 года назад
i know this is a late comment but this system WILL NOT WORK if the collision normal points directly up. the look at function uses the second argument as the 'up vector' for the rotation to take place around, so if the normal happens to align with this vector, the entire rotation will fail
@elvisish6517
@elvisish6517 2 года назад
@Blue Owl 's fix works perfectly! func CreateBulletHole(var target, var raycast, var bullethole): target.add_child(bullethole) if raycast.get_collision_normal().normalized() == Vector3.UP: bullethole.global_transform.origin = raycast.get_collision_point() + raycast.get_collision_normal().normalized() * 0.001 bullethole.rotation_degrees.x = 90 elif raycast.get_collision_normal().normalized() == Vector3.DOWN: bullethole.global_transform.origin = raycast.get_collision_point() + raycast.get_collision_normal().normalized() * 0.001 bullethole.rotation_degrees.x = -90 else: bullethole.look_at_from_position(raycast.get_collision_point(), raycast.get_collision_point() + raycast.get_collision_normal().normalized(), Vector3.UP)
@gplastic
@gplastic 3 года назад
I needed this!
@garbaj
@garbaj 3 года назад
Glad to help
@tejaswadaboria7455
@tejaswadaboria7455 2 года назад
I came here after the shotgun tutorial.the shotgun works perfect but to impliment this in shotguns raycast do I have to make like 10 bullet hole scenes
@paulymclarke
@paulymclarke 3 года назад
Excellent tutorial 🔥
@user-xi7xf9jv5g
@user-xi7xf9jv5g 3 года назад
your videos is amaaaaaaaaaazing
@Klayperson
@Klayperson 3 года назад
Rotating the decal along the y axis will only work for perfectly vertical walls, not ground or slopes etc. You should construct a new basis for the decal such that decal.basis.z == normal. Given a normal and a distance from origin, you can describe the plane in space that contains the polygon. You can then use pythagoras theorem to generate a random point on that plane given a random vector 3 whose dot product with the normal is negative. Let x-axis be the normalized vector from contact to that point. Let y-axis = normal.cross(x). Let x-axis = normal. Construct basis from these vector and assign to decal.
@Klayperson
@Klayperson 3 года назад
Edit: Let Z-axis = normal (commenting on mobile sucks ass)
@garbaj
@garbaj 3 года назад
This sounds like something for the HARD bullet holes tutorial lol! Unfortunately, I didn't understand much of what you wrote, but I'm always looking for better ways to do things and so I'll take some time to try to learn it. Appreciate the tip
@thecringeybatboy491
@thecringeybatboy491 2 года назад
can you show that in script how i can do it, I also want to be able to shoot on floors
@maruf16khan
@maruf16khan 3 года назад
Great Tutorial bruh ❤️️
@the_first_hunter
@the_first_hunter 3 года назад
I hope one day we will make this using shaders
@5minutemovies977
@5minutemovies977 3 года назад
I may be wrong but I think that decals are supposed to be included in Godot 4.0.
@garbaj
@garbaj 3 года назад
you're not wrong
@gamestervirus
@gamestervirus 2 года назад
im getting this error while shooting on ground how can i fix this? E 0:00:14.389 look_at_from_position: Up vector and direction between node origin and target are aligned, look_at() failed. Condition "p_up.cross(p_target - p_pos) == Vector3()" is true. scene/3d/spatial.cpp:691 @ look_at_from_position() Weapon.gd:92 @ _fire() Weapon.gd:51 @ _process()
@tomashutchinson2025
@tomashutchinson2025 2 года назад
How do i get it to work with your shotgun tutorial? I have tried but only one decal seems to appear.
@acle_
@acle_ 3 года назад
great tutorial. thank you!
@mikeYagop
@mikeYagop 2 года назад
Attempt to call function 'add_child' in base 'null instance' on a null instance.
@JoacoN22
@JoacoN22 2 года назад
did you find a solution?
@user-mz6eq8oi5t
@user-mz6eq8oi5t 2 года назад
same problem
@HonsHon
@HonsHon 3 месяца назад
That's because the RayCast is colliding with things like Areas. This caused it for me.
@sajberkg
@sajberkg 3 года назад
Great video! But i noticed that some of my bullet holes doesn't actually align themselves to the surface, mostly when i shoot the ground. Any idea about this?
@rxn7
@rxn7 3 года назад
it's been 6 days, have you found any solution?
@sajberkg
@sajberkg 3 года назад
@@rxn7 Yes! I fixed it like this when i add the bullehole object(b_decal) as a child of the target i did like this: onready var BulletholeDecal = preload("res://Objects/bullet_hole.tscn") var b_decal = BulletholeDecal.instance() if PistolRayCast.is_colliding(): var target = PistolRayCast.get_collider() target.add_child(b_decal) b_decal.look_at_from_position(PistolRayCast.get_collision_point(), PistolRayCast.get_collision_point() + PistolRayCast.get_collision_normal().normalized(), Vector3.UP)
@rxn7
@rxn7 3 года назад
@@sajberkg thanks man, i really appreciate it
@sajberkg
@sajberkg 3 года назад
@@rxn7 No problemo! Glad to help!
@lethn2929
@lethn2929 3 года назад
@@sajberkg Why do I get errors on the floor and ceiling when I use this method?
@littlebiggains3459
@littlebiggains3459 3 года назад
The instanced decal scales itself to the collider... I can make it small etc. but its proportions always reflect the proportions on the wall it instances itself on. It's like the child (decal tscn) inherits the proportions of its parent. So, when I shoot a box, I get a square decal, but when I hit a rectangular wall, the decal will be a rectangle. How do I keep the size of the decal to its original size?
@elvinaszukauskas436
@elvinaszukauskas436 3 года назад
I ran into the same problem. It happens because (well you actually mentioned why it happened) because the bullet decal is a child of a node it collides with. You can simply fix this problem by making the bullet to be a child of a root node. So you would simply want to change this line: raycast.get_collider().add_child(b), to this: get_tree().get_root().add_child(b)
@elvinaszukauskas436
@elvinaszukauskas436 2 года назад
@Strange Cube In this case you would actually want a decal to be a child of a node. To go around the problem mentioned in a master comment I would suggest having the parent node scaled to 1x1x1 at all times and scale the meshes and collisions instead.
@doomknight233
@doomknight233 3 года назад
If you're getting errors when you're shooting at something that is not there, make sure it spawns the bullet_decal if Raycast is colliding. This is how I have mines if raycast.is_colliding(): raycast.get_collider().add_child(bd) bd.global_transform.origin = raycast.get_collision_point() bd.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.UP) bd is the name I gave to the variable the spawns the bullet_decal. Make sure to change it to whatever you named it. In the video's case then bd would be b
@doomknight233
@doomknight233 3 года назад
bd.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.UP) doesn't seem to work so I'll post a solution if I find one
@doomknight233
@doomknight233 3 года назад
Okay so I spent a while and I found some-kind of fix. So I have bd.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.UP) similarly to the video but with a name change except I rotated the decal to 90 degrees instead of it being at 0 and it works but I get a bunch of errors that doesn't interrupt my game but it can be annoying. Idk if I'll make it ignore it or just focus on finding a solution. But help with that error would be greatly appreciated.
@doomknight233
@doomknight233 3 года назад
YES! I finally found the issue to not getting errors anymore. Here's the fixed code if raycast.is_colliding(): raycast.get_collider().add_child(bd) bd.global_transform.origin = raycast.get_collision_point() bd.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.ONE) You do not need to rotate it 90 degrees as I mention before. This fixes all the errors. At least the ones I had. I hope this helps someone in the future.
@damnthishandleistaken
@damnthishandleistaken 2 года назад
@@doomknight233 Whenever I'm shooting at something that doesn't exist the gun just decides to stop functioning from that point onwards
@doomknight233
@doomknight233 2 года назад
@@damnthishandleistaken This is from long ago so I don't remember as much. The problem might be that you need to specify to the script that when you shoot something that doesn't exist to instead ignore it. This might be solved with groups. I hope this helps in some way since I'm not studying Godot as much anymore and I have forgotten a bit about this tutorial. Good luck though
@Zen-rw2fz
@Zen-rw2fz Год назад
you need to update this one for godot 4
@eliyahumedia
@eliyahumedia Год назад
could this method work for making footprints?
@g0ldhat55
@g0ldhat55 3 года назад
hey garabj i need help my decal is not working with this error "E 0:00:02.526 look_at_from_position: Up vector and direction between node origin and target are aligned, look_at() failed. Condition "p_up.cross(p_target - p_pos) == Vector3()" is true. scene/3d/spatial.cpp:692 @ look_at_from_position() Player.gd:49 @ _physics_process()" pls help
@Dragon20C
@Dragon20C 3 года назад
Im not sure why but this doesnt work for me I have the exact same code and the decal doesnt turn flat on the surface and it doesnt even draw on to the surface instead it draws it behind the wall , off the wall so its floating away from the wall at a good distence
@Wonkabonka
@Wonkabonka 2 года назад
if you dont want the game to crash if you're not hitting anything, this is the fix: PS, just change the raycast name back to whatever yours is called! if bulletcast.is_colliding(): var b = bulletdecal.instance() bulletcast.get_collider().add_child(b) b.global_transform.origin = bulletcast.get_collision_point() b.look_at(bulletcast.get_collision_point() + bulletcast.get_collision_normal(), Vector3.UP)
@houmlesakcz
@houmlesakcz 2 года назад
Hello, I have a little problem, i have an assault rifle and want to have bullet holes but it only works if I can once If I hold "fire" it does damage but dont do bullet holes
@sofianouk
@sofianouk 3 года назад
i am so lucky that i found that channel
@ultragamer1017
@ultragamer1017 2 года назад
yeah
@erik90mx
@erik90mx 3 года назад
I have to change the code a little to don't crash whenever you shoot to the sky and in case you add_child to an escalated object, the bullet will not stretch out: if Input.is_action_just_pressed("fire"): var b = bulletDecal.instance() if(aimCast.get_collider() != null): get_tree().root.add_child(b) b.global_transform.origin = aimCast.get_collision_point() b.look_at(aimCast.get_collision_point() + aimCast.get_collision_normal(), Vector3.UP)
@damnthishandleistaken
@damnthishandleistaken 2 года назад
Whenever I'm shooting at something that doesn't exist the gun just decides to stop functioning from that point onwards
@Wonkabonka
@Wonkabonka 2 года назад
this is what i did to fix that problem if bulletcast.is_colliding(): var b = bulletdecal.instance() bulletcast.get_collider().add_child(b) b.global_transform.origin = bulletcast.get_collision_point() b.look_at(bulletcast.get_collision_point() + bulletcast.get_collision_normal(), Vector3.UP)
@Wonkabonka
@Wonkabonka 2 года назад
@@damnthishandleistaken this is how i fixed it: if bulletcast.is_colliding(): var b = bulletdecal.instance() bulletcast.get_collider().add_child(b) b.global_transform.origin = bulletcast.get_collision_point() b.look_at(bulletcast.get_collision_point() + bulletcast.get_collision_normal(), Vector3.UP)
@deepfriedtuba
@deepfriedtuba 3 года назад
I'm getting this error: Attempt to call function 'get_collider' in base 'null instance' on a null instance
@fedoraduck7487
@fedoraduck7487 3 года назад
if you still need help, i solved this by adding "if raycast.is_colliding():" before referencing the collider
@-Name-here-
@-Name-here- 3 года назад
Sounds to me like your shooting into the sky Adding what Fedora duck said should fix that
@TanukiTan
@TanukiTan 3 года назад
when my decal have texture the game freeze a bit when first fire, but not when the material just a albedo color... i use godot 3.3 btw
@jturtle5907
@jturtle5907 3 года назад
Man, how do you always know exactly what I need? I tried doing this myself with 3d Sprites and ended disastrously...
@garbaj
@garbaj 3 года назад
I don't blame ya, 3d sprites have some issues
@Antargataworks13
@Antargataworks13 3 года назад
Nice, thanks!
@Antargataworks13
@Antargataworks13 3 года назад
What?
@Antargataworks13
@Antargataworks13 3 года назад
Hi
@days1835
@days1835 3 года назад
Great tutorial!!!!!!!!!!!!!!!!!!!!!!!!!! pls make one on melee attacks and special attacks....if possible :)
@arnaldoalange3869
@arnaldoalange3869 Год назад
So... i'm having trouble with this part "attempt to call function 'add_child' in base 'null instance' on a null instance can someone help me?
@bnkm07
@bnkm07 2 года назад
Attempt to call function 'get_collider' in base 'null instance' on a null instance. can i pls get help
@smartntboy2474
@smartntboy2474 3 года назад
whenever i get to a certain number it crashes the game and shows the error "Attempt to call function 'add_child' in base 'null instance' on a null instance."
@darknetworld
@darknetworld Год назад
Still work but some change for Godot 4.0. It good ref builds.
@okkd6225
@okkd6225 3 года назад
my game crashes if i shoot up or aim at any one of my trees and if i look down my whole map turns black
@birajboro5869
@birajboro5869 2 года назад
if i shoot it on the ground it does not appear i mean it does but it does not face the right way
@cinomontague
@cinomontague 3 года назад
Goodshit
@titustech7219
@titustech7219 2 года назад
how to add this to the shotgun you made?
@napoliporporo5393
@napoliporporo5393 3 года назад
how to make multiplayer
@exoticzarth9550
@exoticzarth9550 3 года назад
Quick question: whenever I click fire, it freezes and says "attempt to call function 'get_collider' in base 'null instance' on a null instance. HELP
@ultragamer1017
@ultragamer1017 2 года назад
is your script on your player object, because i had it on my camera object and i got the same error. I don't know why it does that but it does
@bradthechad239
@bradthechad239 3 года назад
If I look at the ground and shoot it spawns bullet holes that follow the player around. Any ideas to fix this? Thanks
@rxn7
@rxn7 3 года назад
on your raycast set the exclude parent
@TheMerchant3773
@TheMerchant3773 Год назад
does anyone know how I can trace the ray cast with a line, or color the raycast to make it visible?
@hypra7655
@hypra7655 3 года назад
How to make a fps game in android godot???
@mushroomcrepes4780
@mushroomcrepes4780 2 года назад
Since many noobs will probably have some errors and problems here was my fix to some problems i had using the comments below as help (thank you!) # add this to the top since these are constants and won't be changed const SURFACE_DIRECTION_UP = Vector3(0, 1, 0) const SURFACE_DIRECTION_DOWN = Vector3(0, -1, 0) # the meat of the code, just like the tutorials but with two fixes (read the comments) var b = bullet_decal.instance() get_tree().get_root().add_child(b) # fix for streched decals (adds decal to world instead of making it a child to the mesh) b.global_transform.origin = raycast.get_collision_point() var coll_normal = raycast.get_collision_normal() if coll_normal == SURFACE_DIRECTION_UP or x == SURFACE_DIRECTION_DOWN: # fix for ceiling and floor decals b.look_at(raycast.get_collision_point() + coll_normal , Vector3.RIGHT) return # normal decals on walls and slopes b.look_at(raycast.get_collision_point() + coll_normal , Vector3.UP)
@sivertsivert607
@sivertsivert607 Год назад
How do i set it to wall and floor and the map?
@msboi1218
@msboi1218 2 года назад
is there a way to handle the decals when there isn't a collider, like if you were to shoot at the skybox? I found out in my little test level that if I shoot into infinity it crashes the game
@beau64
@beau64 2 года назад
str(raycast.get_collider()) != "[Object:null]": (raycast.get_collider()) raycast.get_collider().add_child(b) b.global_transform.origin = raycast.get_collision_point() b.look_at(raycast.get_collision_point() + raycast.get_collision_normal(), Vector3.UP) "[Object:null]" is, of course, nothing
@lcjegaming
@lcjegaming 2 года назад
you could try this if raycast.get_collider() == null: return
@msboi1218
@msboi1218 2 года назад
Thanks!
@cunkslant
@cunkslant Год назад
if bulletcast.is_colliding(): might be better so it doesn't run the code unless it collides with something
@thechaxxe3565
@thechaxxe3565 3 года назад
It does not work on the floor, please help.
@garbaj
@garbaj 3 года назад
I've noticed some strange behavior on the floor as well. Still trying to figure out the solution
@thechaxxe3565
@thechaxxe3565 3 года назад
@@garbaj my solution: if r.get_collider() != null: var b = b_decal.instance() r.get_collider().add_child(b) b.global_transform.origin = r.get_collision_point() if r.get_collision_normal() == Vector3(0,1,0): b.rotation_degrees.x = 90 elif r.get_collision_point() != Vector3(0,1,0): b.look_at(r.get_collision_point() + r.get_collision_normal(), Vector3.UP)
@lethn2929
@lethn2929 3 года назад
@@thechaxxe3565 I know this is an old comment but you helped me out a ton because this issue was driving me mad with the way errors were popping up each time I aimed at the floor. Edit: Does anyone know how this would work for ceilings? Still working it out. Edit 2: Use Night Owl's method, it fixes all of the issues with bulletholes on the ceiling and floor.
@davifagundes2359
@davifagundes2359 3 года назад
@@thechaxxe3565 thanks bro! You helped me a lot
@0ozymandias641
@0ozymandias641 2 года назад
@@thechaxxe3565 Sometimes the decals refuse to rotate but I'm going to attribute that to CSG mesh fuckery
@oldfallstorm3064
@oldfallstorm3064 3 года назад
When add it to the Advanced FPS controller it crashes
@gumbo64
@gumbo64 3 года назад
there's a bug where when you shoot something that's scaled up the bullet decal is scaled up too
@pavelmatusu4457
@pavelmatusu4457 3 года назад
yeah, i have the same problem, it can bee fixed by not adding the bullet hole as a child to the object you shoted but to the global node of your world. Problem with it is that if the object you shooted is moving, bullet holes that were on it will just float in the air
@doctormustaqueem2005
@doctormustaqueem2005 3 года назад
Can you please make a short demo on generating endless road in 3d ....it would be great... i couldnt find one.....
@garbaj
@garbaj 3 года назад
I don't know how to do this, but I can look into it
@doctormustaqueem2005
@doctormustaqueem2005 3 года назад
@@garbaj thanks a lot lets hope you can ....it would be very helpful..as in subway surfer...when new chunk is generated....and the objects trailed by camera get deleted....
@ash.n51
@ash.n51 3 года назад
Big pogs
@hingedevoper69
@hingedevoper69 Год назад
it doesnt work on floors for me
@beanofcans
@beanofcans 2 года назад
idk why, but this tutorial didn't work for me at all
@lasloxd
@lasloxd 3 года назад
but in large distances the raycast will fall short and could not call the get_collider_point since it would not detect it and it would not be valid
@rxn7
@rxn7 3 года назад
that's why we are checking first if raycast is colliding
Далее
Melee Weapons (Godot FPS Tutorial)
8:02
Просмотров 31 тыс.
Optimizing my Game so it Runs on a Potato
19:02
Просмотров 552 тыс.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
Просмотров 510 тыс.
Using Composition to Make More Scalable Games in Godot
10:13
How do non-euclidean games work? | Bitwise
14:19
Просмотров 2,4 млн
Complete 3D Shooting Mechanics - Godot 4 FPS Tutorial
12:14
A new way to generate worlds (stitched WFC)
10:51
Просмотров 525 тыс.
I Made the Same Game in 8 Engines
12:34
Просмотров 4 млн