Can someone help me understand this function? Like, i give it the StartLocation, EndLocation, TossSpeed and it returns me a TossVelocity?
I’m probably sounding really stupid, but what is this Velocity? The Speed + Direction?
I’m trying to throw a projectile from A to B. The B point is being deprojected from my crosshair to a worldspace and the A point is the Socket Location at my Pawn.
I want this projectile to move 1000 meters per second, so that’s my Launch Speed.
Again, i’m really sorry if this sounds stupid to ask, i’ve been stuck for a few hours now, lol.
It will give you a velocity (which is both Speed and Direction).
If you want a fixed projectile speed and have no gravity etc, then all you need is the direction from the muzzle point to your cross-hair, and you launch the projectile straight at it (Direction * ProjectileSpeed).
If however, you are simulating gravity or something, and you want the projectile to land at the reticle location and have a fixed projectile speed, then the calculation becomes a quadratic equation and much more complex. It is doable however (what you’re looking for is the launch angle, and you can use that to determine launch direction).
Also, depending on how far away the target point is, there isn’t always a solution that will hit the target - as fixed-speed projectiles have a limited range.