Results 1 to 10 of 10

Thread: Calc Perpendicular (sp?) Vector

  1. #1

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Calc Perpendicular (sp?) Vector

    How do I calculate a vector perpendicular to a vector?

    It is for some easy camera positioning -- creating a 2d game, need the camera to go out perpendicular from the player to a certain distance and stay there.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Calc Perpendicular (sp?) Vector

    A vector can have an undefined amount of perpendiculares. You have to have a "surface" to find a perpendiculare. IE. Two vectors forming a plane.



    ØØ

  3. #3

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Calc Perpendicular (sp?) Vector

    Well if you are willing to aid a bit.
    Remember mario? assume it was a 3D game and the screen scrolling was actually the camera moving. I need to know how to position my camera like that.

    The player moves in the x,y plane -- I need the camera to stay at a certain z distance. Normally this would be easy, but now and then I allow the player to move in all 3 dimensions -- when that movement stops I need to once again calculate the perpendicular of the player position and move the camera accordingly.


    Edit: heh, Well I guess this belongs in a different section now.
    Last edited by Halsafar; Feb 6th, 2005 at 04:20 PM.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: Calc Perpendicular (sp?) Vector

    A vector perpendicular to a plane given by two vectors is its cross product. If you only have one vector given then any other vector will do.. of course i'm not sure what you meant here, since i haven't played mario, cept those good old snes ones
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Re: Calc Perpendicular (sp?) Vector

    Hmm....
    i'm guessing you have a point in the X-Y plane (X, Y, 0), and want to position the camera in another X-Y plane, but raised a certain Z distance....

    this would just be at (X, Y, Zdistance) then....

    maybe i don't undertand...
    sql_lall

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Calc Perpendicular (sp?) Vector

    I am guess he want a Tomb Raider follow head camera. That camera is using Quaternions, and I can't see why he needs the perpendicular for that.


    A good tutorial that is independent on what API you are using is this one. Happy reading...

    http://www.gamedev.net/reference/art...rticle1927.asp

  7. #7
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    Re: Calc Perpendicular (sp?) Vector

    In 2D, the negative reciprocal of the slope will do.

    Y = m X + b

    The line with slope m1 is perpendicular to the line with slope m2
    m2 = -1/m1

    In multi-dimensions (and 2D), the dot product of the two vectors will be zero if the vectors are perpendicular.
    Circa 1995
    Engineer - I think we should put our website address on our paper catalogs.
    Vice President - Don't get too excited about this internet thing.


    I am sorry, but the Oracle was mistaken. You cannot help us.
    -Matrix video game


    I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
    -Linus


    Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.

    That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".


    Are you threatening me, Master Jedi?
    -Chancellor Palpatine

  8. #8

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Calc Perpendicular (sp?) Vector

    My camera is using Quaternions.
    I enjoy all your comment I believe from thus I can solve it.


    Edit: Tomb Raider was a terrible game -- of its genre - which I love, it was probably the worst. Its camera was most annoying.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  9. #9
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Calc Perpendicular (sp?) Vector

    Quote Originally Posted by Halsafar
    My camera is using Quaternions.
    I enjoy all your comment I believe from thus I can solve it.


    Edit: Tomb Raider was a terrible game -- of its genre - which I love, it was probably the worst. Its camera was most annoying.
    Yeah but get in the right position and you can get a good view of her pixellated bum, that was all the fun I had in 1996 .
    I don't live here any more.

  10. #10

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Calc Perpendicular (sp?) Vector

    I had Tifa and FF7
    or
    Celina from SO2 heh

    and of course my SNES which I made lots of non-literal love to.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width