#get the angle of motion
1 messages · Page 1 of 1 (latest)
Putting this in a thread since there's another discussion happening.
This is a fairly simple diagram of the situation (simplified to 2d, but that doesn't really change anything)
If you know trigonometry, you should be able to easily get the angle required
@lone hawk
But bro it is calculating the parabolic path of my grenade so how im supposed to know my path like this , i have tried everything from projectile motion r = u^2 sin 2theta/ G
But i need to angle
To put it in the sin 2 (theta)
Idk how to do it
How am i supposed to use it in a equation?
Using trig, cos (theta) = adjacent / hypotenuse
So cos(theta) = velocity / (horizontal velocity component)
So theta = inverse cos of (velocity / horizontal velocity)
Have you learnt trigonometry in the past? Just curious
Yes
does this make sense?
It is just not much helping to me with text, i understand by listening not reading 🥲
Do you have video tutorial for this ?
Not really, to be honest
Dem
It seems like it should be just straightforward trigonometry
Yea but looks like I've to take help from AI so that it'll simplify it to me with context
But I can try explain it in a different way/draw more diagrams if those help at all
Yea they'll help
You can try, but do be careful, it may end up simply making up stuff that isn't true
I'll show u what it said , how's that look to u?
From having mentioned projectile motion, am I right in guessing you've done some amount of physics before?
Yes sir
It should be a problem similar to ones you would encounter often in physics, the trick is just to be able to see it as
Have you worked with projectile motion where you get a setup like this?
If you can combine your linearVelocity.x and linearVelocity.z (using pythagoras' theorem, a^2 + b^2 = c^2), then that value will be your Vx in the diagram
Then you can find the value of V, which is linearVelocity.magnitude
Now you have all 3 sides of the triangle:
V: linearVelocity.magnitude
Vy: linearVelocity.y
Vx: Mathf.Sqrt(linearVelocity.x * linearVelocity.x + linearVelocity.z * linearVelocity.z)
So you can pick any two of them to get the angle (from the horizontal), which you would use in your projectile motion formula
No sir its first time I'm doing this and its getting tricky
Ok but que is I don't know where my grenade is landing , idk my X and Y
How this system is actually working , like it is making path of my grenade (before throwing ), but how it can guess where my grenade is gonna land or go
Is there any way so that i can get the angle from where im throwing it like to suppose my 0° (theta)?
Yes, that's what I'm trying to show you
You shouldn't need to know where it will land to be able to map out the path
Ok, so basically, you can think of a velocity in two dimensions as being made of 2 "components", in the x and y
In 3 dimensions you just add one more, the z component
In unity this is linearVelocity.x, linearVelocity.y, linearVelocity.z
But in this case we can pretend it's in two dimensions, as if we are looking at the path directly from the side
In which case the horizontal component (the "x" component in 2d) will be made of the Z and X components, in the same way that the whole velocity is made of X, Y and Z
The magnitude of which can be found from pythagoras' theorem (a^2 + b^2 = c^2)
So we can use the magnitude of either the horizontal or vertical component of the velocity, and the magnitude of the velocity, as the side lengths of a triangle to find the angle
In the end I think (I may make a mistake in the syntax, I haven't spent any time checking), you should be able to get the angle with:
float angle = Mathf.Asin(linearVelocity.y/linearVelocity.magnitude)
Where linear velocity is the object's velocity
I realised I was making it a bit more complicated with the whole turning x and z into another vector part, it's not exactly necessary since you can just use the y component
I haven't verified but this video: https://www.youtube.com/watch?v=1eRimU5befo
In this video you will understand how to solve All tough projectile motion question, either it's from IAL or GCE Edexcel, Cambridge, AQA, JEE or ANY examinations. The advance level question worksheet video will be uploaded as soon as I am done editing.
For MCQ questions look at this link here:
https://www.youtube.com/@ThatPhysicsGuy/community...
might be helpful for explaining projectile motion
thank you so much buddy i understood , i just want to know that this float angle = Mathf.Asin(linearVelocity.y/linearVelocity.magnitude) will give me the angle by which my object is going , right?
and then i can use this with my line renderer to show the path to my player like in pubg , right?
I’m like 99% sure that should work
I don’t know what line rendering system you’re using/making, but it needs to be able to take an initial angle and draw the full curve from I
Also, since I’m guessing you want the line to appear before the object is thrown, you can just check what velocity you will give the object and use that for the calculation
Anyway, best of luck for getting it all made!