1 / 12

Projectile Arch:

Projectile Arch:. A Look into ways to fix an elongated projectile that is lobbed. The Problem. An elongated projectile is something like an arrow, a javelin, or any other long item that will change angle when thrown

rea
Download Presentation

Projectile Arch:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Projectile Arch: A Look into ways to fix an elongated projectile that is lobbed

  2. The Problem • An elongated projectile is something like an arrow, a javelin, or any other long item that will change angle when thrown • As a elongated projectile is lobbed along an arch its tip needs to always point in the proper direction.

  3. Without Solution • If left alone the projectile would follow the arch path but the tip would never change • The picture to the left shows a progression of a stick thrown without correction • Red Line is the path • Brown Line is stick

  4. With Solution • When corrected the projectile would follow the arch path and the tip would fallow the correct angle with the flight • The picture below shows a progression of a stick thrown with correction • Red Line is the path • Brown Line is stick

  5. Why Is This Important • First and most obvious is that this adds a level of realism to the flight of our projectile • Another major reason is that it allows for our physics to be applied to our projectile properly in the air • Also this gives the right angle in which the projectile hits either a wall or the ground so that it can stick or bounce correctly

  6. How to do this • There are two ways of doing this • Both use two locations taken from two ticks of the clock. • The first takes and triangluates the two locations and calculates the angle from the original point. • The second way uses the two Locations as vectors.

  7. Triangle Way • With a location there are three componets (X,Y,Z) • The distance from the prior location to the current location using the X and the Y components of location. • You then use the Pythagorean theorem to gain the XY distance • Then Find the distance from the Z of the old location to the Z of the new location by subtracting them. • This gives you your height (opposite) and your length (adjacent) which you can then use to calculate the angle between the length (in the XY plane so level with the ground) and the hypotenuses.

  8. Code for Triangle Way

  9. Vector Way • The Vector way can be done in one line of code (Bar the collection of curPoint and oldPoint done as in the Triangle way) • SetRotation(rotator(curPoint - oldPoint)); • Subtracting the two vectors gives us a vector that points from one vector to the other • Then casting that to a rotator and then setting the rotation it gives the same effect of the Triangle way

  10. Triangle vs. Vector • Both these have the same outcome in the end • The vector way is fast and code efficent but leaves us with little information and less options for customization • The Triangle way is a lot of math and can be CPU intensive However we know a ton of information about the movement and we have left a lot of room for customization such as putting a spin on the object

  11. Conclusion • There is a problem with shooting an elongated projectiles that do not correct the angle it points in correspondence with the ground • There are two methods to fix this with, Triangle Method, Vector Method • Triangle Method is Math intensive but can weigh heavy on the CPU • The Vector Method is fast and simple but can leave us with little information about the move

  12. Contact This tutorial was made by Chris Kincanon Please Email me at Catsith@gmail.com with any questions or corrections Thank You

More Related