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
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
Short and sweet. I liked and subscribed
Very useful tutorial! Helped me out lot.
Best visual explanation i've ever seen. Keep up the great work💯
@ForlornU
10 ай бұрын
Thanks, will do!
Very interesting and useful, thanks for your effort
That’s actually really cool
Very good, thanks for sharing ☺
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
Жыл бұрын
Happy to help! Best of luck on your project!
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
Hi , Ive just come across your channel. Ive Subbed and hope to see more content !!
@ForlornU
7 ай бұрын
Appreciate the support! More content will come 👍
bro this is so underated
good
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
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
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
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
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
how can i change the value to z, because i try to use vector3 but its error missing reference
@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
How would you go about, doing something like an arrow so it rotates along the path
@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
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
7 ай бұрын
@@lilbaby4PF glad to help!
vector 3 Velocity= Projectile.initialSpeed/projectile.mass* projectile.direction ....what formula is that ?
@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.
Guau!, okey, good, I going to applied it into Stride Engine. Already I applied a RayToOrigin(), the next is this.
@ForlornU
8 ай бұрын
Best of luck!
Would love to see this but in Godot!
man i hate tuples
@ForlornU
8 ай бұрын
Sorry about that! 😂 Seemed like a fun idea at the time
you should shown the actual scripts to understand it more rather than doing like this and talking about it and confuse us. 😔👎
@defanserb
3 ай бұрын
He literally described every line of code in detail and you still complaining
@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
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.