Results 1 to 9 of 9

Thread: Normals, planes - major probs!

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    6

    Normals, planes - major probs!

    I am attempting to construct a roller coaster simulator. Each track piece is defined by a right handed pair of vectors. A direction vector, and up vector and a normal vector. I can use the direction vector ok, but how do I calculate the up vector from the directional vector?

    Once this is cracked I then want to rotate the up vector around directional vector to get track pieces to bank.
    http://www.angelfire.com/or3/w0042625/roller.jpg
    http://www.angelfire.com/or3/w0042625/roller2.GIF

    Cheers
    Iain
    i.toft@uea.ac.uk

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    6

    Re: Normals, planes - major probs!

    Copy and past the above links into a browser window, don't click as they won't work!

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    204

    Re: Normals, planes - major probs!

    Is the 'Up' vector straight into the sky or 90 degrees off of the surface of the track?

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    6

    Re: Normals, planes - major probs!

    At the moment is fixed at (0, 1, 0) however I need to calculate it according to the directional vector so it is always at a right angle to the directional vector. Reason for this is for lighting and also so the first person cam can take the up vector for each track piece.
    Iain

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    6

    Re: Normals, planes - major probs!

    If you look at that second picture it should explain what I need, copy and paste the link into a browser window to get it to work(damn angel fire).
    Iain

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: Normals, planes - major probs!

    To keep the Up vector perpendicular to the Front vector use the following. This should work so long as the front vector has not rotated so much that it is parallel to the CurrentUp vector.

    Right = Front x CurrentUp
    NewUp = Right x Front
    Normalise NewUp

    Rotating it around the Front vector by an angle A is given by the following. |CurrentUp| is the length of the CurrentUp vector. However, if you use this you will have to normalise / correct the length of the NewUp vector after a couple thousand rotations. The calculations give rounding errors after a while.

    NewUp = CurrentUp * cos(A) + NormalisedRight * sin(A) * |CurrentUp|

    There might be faster ways to do this. If anyone knows share it with us

  7. #7
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    204

    Re: Normals, planes - major probs!

    Why cant you just use the surface normal?

  8. #8
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Sydney, NSW, Australia
    Posts
    426

    Re: Normals, planes - major probs!

    I dont really understand what you want, but to get a vector perpendicular to 2 other vectors you need to Cross product those 2 vectors to get it.
    :: Sleep is a poor substitute for caffeine ::

  9. #9
    Senior Member Regular Contributor
    Join Date
    Dec 2001
    Location
    Belmont, CA, USA
    Posts
    216

    Re: Normals, planes - major probs!

    Here's my first suggestion: Rename your vectors! Use direction, left, and up (or normal). A "normal" vector is a specific vector which is not the same as your "normal" vector. You will save yourself (and everybody else) a lot of confusion.

    If you have two vectors, you can get the third using the cross-product.

Similar Threads

  1. Replies: 4
    Last Post: 11-23-2015, 04:31 AM
  2. Row major vs Column Major in 4.1
    By charliejay in forum OpenGL: General
    Replies: 5
    Last Post: 04-06-2011, 05:57 AM
  3. Need Some help, got some major problems
    By JerseyDevil in forum OpenGL: Windows
    Replies: 1
    Last Post: 03-29-2004, 12:56 AM
  4. Normals and planes
    By blender in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 04-18-2002, 09:05 AM
  5. Major quake 3 help!!!!
    By Quakeboy_2000 in forum OpenGL: User Software
    Replies: 4
    Last Post: 08-04-2001, 05:26 PM

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