Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Projectile Arch: A Look into ways to fix an elongated projectile that is lobbed."— 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 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. 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 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 The picture to the left shows a progression of a stick thrown without correction Red Line is the path Red Line is the path Brown Line is stick 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 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 The picture below shows a progression of a stick thrown with correction Red Line is the path Red Line is the path Brown Line is stick 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 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 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 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 There are two ways of doing this Both use two locations taken from two ticks of the clock. 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 first takes and triangluates the two locations and calculates the angle from the original point. The second way uses the two Locations as vectors. The second way uses the two Locations as vectors.

7 Triangle Way With a location there are three componets (X,Y,Z) 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. 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 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. 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. 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) 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)); SetRotation(rotator(curPoint - oldPoint)); Subtracting the two vectors gives us a vector that points from one vector to the other 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 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 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 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 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 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 There are two methods to fix this with, Triangle Method, Vector Method Triangle Method is Math intensive but can weigh heavy on the CPU 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 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 Catsith@gmail.com any questions or corrections Thank You


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

Similar presentations


Ads by Google