Results 1 to 6 of 6

Thread: Vector : a trigonometric problem

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    477

    Vector : a trigonometric problem

    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.

    1)

    - The anle = 0°
    - The vector's lenght = 10

    2)

    - The angle = 90°
    - The vector's lenght = 10
    ==> In this case, X will be equal to - 10 and Y to 0

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    477

    Re: Vector : a trigonometric problem

    Ok, I've found

    Thanks ...

  3. #3
    Guest

    Re: Vector : a trigonometric problem

    Struggling with BASIC trig like this is a sure fire sign that you are NOT ready to do stuff like this.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    477

    Re: Vector : a trigonometric problem

    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 ?

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Vector : a trigonometric problem

    3D vector math
    http://members.tripod.com/~Paul_Kirb...r/VLintro.html


    Originally posted by Leyder Dylan:
    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 ?

  6. #6
    Junior Member Newbie
    Join Date
    Jul 2000
    Location
    Morrisville, NC
    Posts
    27

    Re: Vector : a trigonometric problem

    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

Similar Threads

  1. Very odd problem with Reflection vector
    By TheFearlessHobbit in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 06-01-2017, 07:48 PM
  2. Replies: 2
    Last Post: 09-03-2014, 07:45 AM
  3. Normal Vector problem
    By hbkmad in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-21-2014, 04:43 AM
  4. fast trigonometric functions
    By fodder in forum OpenGL: General
    Replies: 7
    Last Post: 06-20-2004, 05:24 AM
  5. Vector and Font problem!
    By kaysoft in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 10-10-2002, 11:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean