Hi,
I’d like to calcul the traject for
my bullet but I’ve a trigonometric problem
and it’s so far for me, about 4 years …
Here’s my example :
I’ve a vector who begins at X, Y ==> (0,0)
His length is : 10
On the example, if the angle is equal to 0°,
the vector’s direction will be X,Y ==> (0,10).
But my question is, where will be the vector
if the angle equals 30° ???
So, I must consider this :
The angle
The lenght of my vector
What’s the formul for calculating this ?
It’s possible to apply this formule
with a example. I’m gonna take this example.
The anle = 0°
The vector’s lenght = 10
The angle = 90°
The vector’s lenght = 10
==> In this case, X will be equal to - 10 and Y to 0
system
July 27, 2002, 8:22pm
3
Struggling with BASIC trig like this is a sure fire sign that you are NOT ready to do stuff like this.
It’s me again.
So, it’s works only for 2D but now, I want to use that with 3D.
10 ==> Vector lenght
X = 10 * sin(thetaY)
Y = 0
Z = - 10 * cos(thetaY)
My question is ==> What about Y if Y is not equal to 0 ?
3D vector math
http://members.tripod.com/~Paul_Kirby/vector/VLintro.html
Originally posted by Leyder Dylan:
[b]It’s me again.
So, it’s works only for 2D but now, I want to use that with 3D.
10 ==> Vector lenght
X = 10 * sin(thetaY)
Y = 0
Z = - 10 * cos(thetaY)
My question is ==> What about Y if Y is not equal to 0 ?[/b]
Bode
October 29, 2002, 11:57am
6
Hi…
I’ve been using this to calculate the trajectory for a bullet in 3D:
TimeStep += .01 //or whatever incremental amount you want
//velocity is just that…the velocity of your bullet
//X,Y,Z is the starting point of your bullet
//frontVector is where direction vector of where the gun barrel is aimed
Float cosA = cos(Angle * .01745329);
Float sinA = sin(Angle * .01745329);
float distance = cosA * timeStep * velocity;
float height = velocity * sinA * timeStep - 0.5f * 0.8f * timeStep * timeStep;
float newDistance = ((distance / 2.0f) * 0.05f);
float newHeight = (height / 2.0f) * 0.05f;
float newX = (frontVector.x * timeStep) + X;
float newY = newHeight + Y;
float newZ = (frontVector.z * timeStep) + Z;
Bode