Тёмный

2D Animated Trajectory Line in Godot (with collisions!) 

MrElipteach
Подписаться 10 тыс.
Просмотров 19 тыс.
50% 1

I show you how to calculate the trajectory of an object taking into account collision to draw it using a Line2D. I also show you how to texture the line and animate it using a shader!
MADE FOR GODOT 3.5
🎓 Learn how to make JUICY games 👇
www.udemy.com/course/learn-ho...
💻 Checkout the sources
github.com/MrEliptik/godot_ex...
USEFUL STUFF
~~~~~~~~~~~~
🔗 KidsCanCode tutorial
kidscancode.org/godot_recipes...
👤 SOCIALS
~~~~~~~~~~~~
💰 One time donation: ko-fi.com/mreliptik
💰 Support me on Patreon: / mreliptik
🟣 Join us on Discord: / discord
🔴 Twitch: / mreliptik
🐤 Twitter: / mreliptik
🎥 TikTok: / mreliptik
🖼️ Instagram: / mreliptik
🔗All links: bento.me/mreliptik
🖥 SETUP
~~~~~~~~~~~~
These links are affiliate, it helps me if you buy through them!
💻 PC/desk setup
Ultrawide Monitor: LG 29": amzn.to/4bVcwd9
24" HP monitor: amzn.to/48Fi8We
Electric standing desk legs: amzn.to/3uQDpyj
Chair: not the exact same, but better: amzn.to/48yL1n8
SSD: Samsung 980 pro: amzn.to/3OWUcqw
Stream deck: amzn.to/4bYcOjy
Mic: Maono AU A04: amzn.to/4bSBHgB
Keyboard: MX mechanical: amzn.to/3wBwYzT
Mouse: MX master 2S: amzn.to/3wsMy0s
Earbuds: OnePlus Nord Buds 2: amzn.to/3OYQNHq
Elgato Mounting Pole: amzn.to/3P1UYSO
Xbox Series controller: amzn.to/4c6DRcK
Heated desk pad 🔥: amzn.to/3TgWyTw
USB desk fan: amzn.to/48AbZdK
Tablet: Samsung S6 lite: amzn.to/3wu4zvk
Walking treadmill: amzn.to/3T50EwW
📹 Camera
Camera: Sony ZV E10: amzn.to/4bXhfem
Lense: Tamron 17-70: amzn.to/3wGKSR2
Tripod K&F: amzn.to/3In4psg
SD card: SanDisk 128GB: amzn.to/3STzZTD
📚 Books
Steal like an artist: amzn.to/42Uloff
How innovation works: amzn.to/42ZfLMX
Turtles, Termites, and Traffic Jams: Explorations in Massively Parallel Microworlds: amzn.to/3UYBVN3
CHAPTERS
~~~~~~~~~~~~
00:00 - Intro with result
00:16 - Main scene setup
00:33 - Projectile
01:09 - Trajectory
02:20 - Collision
03:34 - Texture
04:26 - Animation Shader
06:23 - Outro

Игры

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

 

11 июл 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@mrelipteach
@mrelipteach Год назад
I hope you like the video! Give me ideas on what you'd like to see next 👇 Checkout the sources github.com/MrEliptik/godot_experiments
@saulnores3477
@saulnores3477 Год назад
I'd like to see a soccer game tutorial.
@toupocallen7572
@toupocallen7572 Год назад
The same video in 3D?
@leothelaen1970
@leothelaen1970 Год назад
Great tutorial, thank you!
@ColorauGuiyino
@ColorauGuiyino Год назад
Very useful, thank you for sharing.
@brunodbrito
@brunodbrito Год назад
thx dude! helped me a ton! i already had a trajectory predict on my game, but was sooooo bad and yours look so much cleaner.
@mrelipteach
@mrelipteach Год назад
Glad it was helpful!
@AndreaDoimo
@AndreaDoimo Год назад
Thank you! Was looking for animating the texture, and works in Godot 4!
@mrelipteach
@mrelipteach Год назад
Glad I could help!
@generrosity
@generrosity Год назад
This is very cool! And I can see how this could be easily extended for 3d too. Thanks!
@mrelipteach
@mrelipteach Год назад
Yeah it can easily be extended to 3D! I'm glad you see how :) Don't hesitate to share if you do it.
@yuzu-dev
@yuzu-dev Год назад
Thank you!
@rakimo6493
@rakimo6493 Год назад
Fantastic, thank you!
@mrelipteach
@mrelipteach Год назад
Glad you liked it!
@EvaldoBratti
@EvaldoBratti 5 месяцев назад
That was very clever, thank you
@mrelipteach
@mrelipteach 5 месяцев назад
Glad you liked it!
@time608
@time608 6 месяцев назад
Very good Tutorial Thanks a lot 😊😊😊
@mrelipteach
@mrelipteach 6 месяцев назад
Glad it was helpful!
@arandomperson12345
@arandomperson12345 3 дня назад
To those doing this tutorial in Godot4.2 or higher, the collision.normal reference should now be a function collision.get_normal() instead.
@eanggawahyu
@eanggawahyu 4 месяца назад
hi, this is very impressive ❤❤❤❤, interesting if you make a 3D tutorial, I would really like it
@isukwithnames1811
@isukwithnames1811 Год назад
Thanks for the tutorial it's super handy. My only question is How do I tweak this So I can make a startdew valley style fishing rod? My game is topdown Zelda style and not a side scroller/platformer style game
@pashakurozeev5516
@pashakurozeev5516 Год назад
Hello! Please make lessons on creating fishing in godot!
@agriasoaks6721
@agriasoaks6721 Год назад
could you also make a tutorial about how to make the AoE of the impact? you know the red shape that indicates where the impact is going to be
@xtreme-software
@xtreme-software Год назад
Yes, please. That would be great.
@dupasmokagaming700
@dupasmokagaming700 5 месяцев назад
thanks buddy for the great vid! was looking for something like this for a while already. Just a question though - sorry if it's dumb I only started coding 3 weeks ago... ;D - so you put that variable 'dir' to the projectile script, but I assume it has to be updated somehow with your aiming method? like you move right or left to change the aim position (?) how it gets updated? Was looking for this project on github (link that you provided) but couldn't find it. Many thanks for the support mate! cheers
@dupasmokagaming700
@dupasmokagaming700 5 месяцев назад
just found the trajectory line project - will check it out myself ;) thanks anyway!
@darkfield1952
@darkfield1952 3 месяца назад
@@dupasmokagaming700 where did you find it?
@dupasmokagaming700
@dupasmokagaming700 3 месяца назад
@@darkfield1952 I think he moved it to somewhere else
@TheAlison1456
@TheAlison1456 9 месяцев назад
Thanks.
@mrelipteach
@mrelipteach 9 месяцев назад
You're welcome
@mulberrytg
@mulberrytg Месяц назад
great tutorial! Thanks! I'm interested in how I could do something similar in 3D?
@mrelipteach
@mrelipteach Месяц назад
Most of it is similar in 3D apart from the line drawing. AFAIK there's no easy way to draw a line like this. You have to use instant geometry but if you draw a line, you'll be limited in terms of thickness and stuff. The solution is to draw a line composed of triangle to control the thickness. Maybe you can find an addon to help with that?
@mulberrytg
@mulberrytg Месяц назад
@@mrelipteach thanks for your reply! I'll have to look into it more
@-Solenya
@-Solenya Год назад
Very cool thank you! Is there a way to do this on a top down 2d game?
@mrelipteach
@mrelipteach Год назад
I don't see how that would work in a top down game as you see things only from above so you don't see the trajectory
@mrmikojo5738
@mrmikojo5738 4 месяца назад
Add a shadow that follows along the ground in a straight line from the player and the spot where the first bounce lands. Then just don’t let it bounce around as much. It would need to stay near or along the same trajectory from the bounce to fake the top down perspective.
@braven4053
@braven4053 Год назад
The same effect using vertex function: void vertex(){ UV.x -= TIME * speed; }
@mrelipteach
@mrelipteach Год назад
Thanks for giving another solution!
@mrvodkins
@mrvodkins 10 месяцев назад
also this solution don't ruin gradient. Thanks!
@cashpay50
@cashpay50 11 месяцев назад
I'm having problem with this, my collision shape is an arbitrary shape. Whenever trajectory is display, it is so much different from the actual things shot out.
@mrelipteach
@mrelipteach 11 месяцев назад
have you used the same shape for the kinematicbody used to predict the collisions?
@amarrok8010
@amarrok8010 4 месяца назад
Como podria lanzar un objeto en esa direccion en ves de instanciarlo ? Intente pero en ves de lanzar simplemente lo suelta .. pero si lo instancio no tengo problema , alguna idea o manita ??😊
@mrelipteach
@mrelipteach 4 месяца назад
You need to instance an object and give it the same direction and speed as you're using for the path calculation
@amarrok8010
@amarrok8010 4 месяца назад
@@mrelipteach entonces Si o Si hay que instanciarlo , pero ahí es cuando tengo otro problemas y es que al instanciar el objeto , dicho objeto no tiene el script que debería tener ...
@Jhonbxl
@Jhonbxl 4 месяца назад
For those wanting to do this under Godot 4, the repeat property has been moved ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dkDVRyHjzeI.html
@innerdev
@innerdev Год назад
Does it work with godot4?
@mrelipteach
@mrelipteach Год назад
You'll probably have to adapt a few things as it was made for Godot 3.5 but it's very similar yes
@amarrok8010
@amarrok8010 5 месяцев назад
hola muy buen video pero no lo encuentro en el github, alguna idea ?
@mrelipteach
@mrelipteach 5 месяцев назад
This was a Godot 3.x project so it's in the 3.x branch: github.com/MrEliptik/godot_experiments/tree/3.x/2D/trajectory_line
@amarrok8010
@amarrok8010 5 месяцев назад
​@@mrelipteach seria posible en ves de instanciar el objeto ( como si fuese una bala o similar ) aplicarle impulso ? Mi idea era lanzar mi objeto siguiendo la trayectoria de la línea pero sin instanciarlo , alguna idea ?
@hungp.t.9915
@hungp.t.9915 11 месяцев назад
hmm, 3.5.2 texture doens't repeat (I cloned the git)
@mrelipteach
@mrelipteach 11 месяцев назад
Make sure the texture is set to tile in the import tab and then on the line2D make sure under fill > texture mode to select Tile
@hungp.t.9915
@hungp.t.9915 11 месяцев назад
@@mrelipteach Oh I found it, dotted_line.png > Import tab > Texture > Flags > Repeat = Enabled ====== I think you mean Repeat in the import tab
@rafatokarczyk6904
@rafatokarczyk6904 Год назад
my trajectory line doesn't even show up... please help me
@realjames1
@realjames1 Год назад
same here, no idea why
@rafatokarczyk6904
@rafatokarczyk6904 Год назад
@@realjames1 like i watched the whole video about 5 times to find my mistake but i couldn't find it
@realjames1
@realjames1 Год назад
@@rafatokarczyk6904 found the issue, it turns out you can't run the update trajectory function outside the line2d, I had to just make a script and attach it to the line2d and it works fine
@TheAlison1456
@TheAlison1456 9 месяцев назад
timestamps for your video 0:33 Projectile 1:09 Trajectory 2:20 Collision 3:34 Texture 4:26 Animation Shader 6:23 Outro copypaste then delete this comment if u can
@JasonEllingsworth
@JasonEllingsworth 7 месяцев назад
oof this is not beginner friendly. Understandable that it is an intermediate thing and is quickly stated for someone more familiar with code, but I would have to try and dissect all this information down so I could understand why you are doing each thing, so I could replicate it in the future.
@TheStickofWar
@TheStickofWar 5 дней назад
That's the application of math in the real world for you
@alonzo_go
@alonzo_go 7 месяцев назад
how do I go about doing this in godot 4? in the texture reimport part, there's no "repeat" option in godot 4 therefore it only shows the image 1 time along the line...
@mrelipteach
@mrelipteach 7 месяцев назад
It's on the nodes themselves now. You'll find the same options under "texture" on your line2D
Далее
10+2 AWESOME ADDONS for GODOT 4
8:36
Просмотров 128 тыс.
GODOT TUTORIAL: Shockwave shader for noobs
15:48
Просмотров 49 тыс.
I Made a Graphics Engine
6:42
Просмотров 244 тыс.
10 AWESOME ADDONS for GODOT 4
5:42
Просмотров 60 тыс.
Third person Dynamic Vaulting in Godot 4
2:40
Просмотров 14 тыс.
You're asking questions wrong
8:14
Просмотров 770
I recreated Balatro's effects in Godot
8:04
Просмотров 25 тыс.
Making Effects with Godot Visual Shaders
18:15
Просмотров 13 тыс.
Make Your Own Raycaster Part 1
16:52
Просмотров 406 тыс.
The DEFINITIVE FPS Tutorial for Godot 4.X (FULL COURSE)
2:41:46
Introduction to UI Containers in Godot 3 (tutorial)
9:35
Заводи T77 Киберфермер
1:06
Просмотров 32 тыс.