Projectile Trajectory Predictor - Unity Physics & Coding Tutorial

Video Content
----------------------------------
0:00 - Intro
0:19 - Explanation
1:28 - Bounces, complexity
1:53 - Scene Setup
2:11 - Input handling
3:17 - Code
5:53 - Settings
6:45 - Firing Input
7:34 - Hit marker
8:17 - Last touches, outro
-----------------------------------
Here is a project focused on predicting trajectories for projectiles, thrown object and such.
It's nothing too fancy but a must-have for any project that requires such tools!
Download the project here:
github.com/ForlornU/Trajector...
Further reading for more advanced physics simulations and for predicting multiple bounces:
docs.unity3d.com/Manual/physi...
learn.unity.com/tutorial/mult...
#coding #csharp #gamedev #trajectory #unity

Пікірлер: 37

  • @ForlornU
    @ForlornU7 ай бұрын

    I made a follow up video on this where we calculate a trajectory between two points, the force and velocity needed to get from one to the other, it's similar but more geared towards something AI controlled, It's the Advanced Targeting part that you want to look out for kzread.info/dash/bejne/jKaOu6eFZNrcm9I.html

  • @henryqng
    @henryqng Жыл бұрын

    Short and sweet. I liked and subscribed

  • @simon5986
    @simon5986Ай бұрын

    Very useful tutorial! Helped me out lot.

  • @jakobanzengruber8688
    @jakobanzengruber868810 ай бұрын

    Best visual explanation i've ever seen. Keep up the great work💯

  • @ForlornU

    @ForlornU

    10 ай бұрын

    Thanks, will do!

  • @spruslaks26
    @spruslaks26 Жыл бұрын

    Very interesting and useful, thanks for your effort

  • @Notllamalord
    @Notllamalord11 ай бұрын

    That’s actually really cool

  • @castlecodersltd
    @castlecodersltd7 ай бұрын

    Very good, thanks for sharing ☺

  • @johnraygames3106
    @johnraygames3106 Жыл бұрын

    YOU ARE A LIFE SAVER! I am an indie VR developer and needed to make this exact mechanic for my game. The code was super easy to adapt to VR and I can't thank you enough. I have subscribed.

  • @ForlornU

    @ForlornU

    Жыл бұрын

    Happy to help! Best of luck on your project!

  • @akop1194
    @akop1194Ай бұрын

    Hey dude! Where did u place the struct component called ProjectileProperties? How did you use it? Like, did you place it inside another script or did you create a script just for that? Great video btw

  • @random_precision_software
    @random_precision_software7 ай бұрын

    Hi , Ive just come across your channel. Ive Subbed and hope to see more content !!

  • @ForlornU

    @ForlornU

    7 ай бұрын

    Appreciate the support! More content will come 👍

  • @TheAstrocricket
    @TheAstrocricket Жыл бұрын

    bro this is so underated

  • @Unity_Tutorial_Games
    @Unity_Tutorial_Games Жыл бұрын

    good

  • @gwm249
    @gwm24910 ай бұрын

    Nice informative video. I happened across this while trying to look for something to help with having an enemy/npc attacking with a bow and calculating angle and power needed to get it to a destination. I'm not sure if I can reverse engineer your code to get something similar or if maybe you have some advice?

  • @ForlornU

    @ForlornU

    10 ай бұрын

    I believe that would require an entirely different set of calculations and it would probably be easier to start from scratch. I found this thread about it if that's helpful, otherwise it's not something I can answer at this time. You have given me an idea for a future video tho, thank you :) Trajectory Formula - discussions.unity.com/t/trajectory-of-a-projectile-formula-does-anyone-know-maths/15628/5

  • @gwm249

    @gwm249

    10 ай бұрын

    @ForlornU Thanks, I appreciate the help :) I'll look forward to that one. I just started this game dev thing (at 42, but I guess you're never too old to learn something new) so anything is useful.

  • @kptmaci4979

    @kptmaci4979

    7 ай бұрын

    @@ForlornU Im looking for the same thing. I dont think anyone found easy solution for this and many people are asking this online. No easy code to adapt, so that video would be highly appreciated!

  • @ForlornU

    @ForlornU

    7 ай бұрын

    I did get around to making that video, I hope it helps! It's the Advanced Targeting part that you want to look out for kzread.info/dash/bejne/jKaOu6eFZNrcm9I.html

  • @shidou2380
    @shidou238011 ай бұрын

    how can i change the value to z, because i try to use vector3 but its error missing reference

  • @ForlornU

    @ForlornU

    11 ай бұрын

    I'm not sure I understand your question, which value? What reference is missing? You can contact me on either Discord or Reddit, search for user ForlornU and dm me a screenshot and/or a pastebin with code. I want to help but need more information

  • @lilbaby4PF
    @lilbaby4PF7 ай бұрын

    How would you go about, doing something like an arrow so it rotates along the path

  • @ForlornU

    @ForlornU

    7 ай бұрын

    In my other video on trajectories I have arrows rotating along their velocity, it's a simple shorts script - kzread.info/dash/bejne/jKaOu6eFZNrcm9I.html

  • @lilbaby4PF

    @lilbaby4PF

    7 ай бұрын

    @@ForlornU Thanks wasn't familiar with rotating along velocity, experimented and it works fine. Was incrementally rotating along line path which was less efficient

  • @ForlornU

    @ForlornU

    7 ай бұрын

    @@lilbaby4PF glad to help!

  • @muhammadumair-ql5sm
    @muhammadumair-ql5sm9 ай бұрын

    vector 3 Velocity= Projectile.initialSpeed/projectile.mass* projectile.direction ....what formula is that ?

  • @ForlornU

    @ForlornU

    9 ай бұрын

    It's not really a formula. Velocity is a direction and a speed: initialSpeed*direction, however to calculate for the objects mass i divide the speed with the mass, mass acting as a multiplier usually between 0 - 1.

  • @diegohiroshiysusvideos2909
    @diegohiroshiysusvideos29098 ай бұрын

    Guau!, okey, good, I going to applied it into Stride Engine. Already I applied a RayToOrigin(), the next is this.

  • @ForlornU

    @ForlornU

    8 ай бұрын

    Best of luck!

  • @TheLazyJAK
    @TheLazyJAK7 ай бұрын

    Would love to see this but in Godot!

  • @__Rizzler__
    @__Rizzler__8 ай бұрын

    man i hate tuples

  • @ForlornU

    @ForlornU

    8 ай бұрын

    Sorry about that! 😂 Seemed like a fun idea at the time

  • @LION303200
    @LION3032003 ай бұрын

    you should shown the actual scripts to understand it more rather than doing like this and talking about it and confuse us. 😔👎

  • @defanserb

    @defanserb

    3 ай бұрын

    He literally described every line of code in detail and you still complaining

  • @ForlornU

    @ForlornU

    3 ай бұрын

    Explaining function by function is optimal, if its confusing, the code and the entire project is provided and you can open it side by side to follow along :)

  • @mr.krawkoskiproductions82

    @mr.krawkoskiproductions82

    22 күн бұрын

    @@ForlornU i can get that, but it was super confusing when you didnt say what script some functions where in. Such as the struct. I did'nt realize that was its own script component until i found it in the git files.