|
-
Feb 6th, 2005, 03:36 PM
#1
Thread Starter
PowerPoster
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
-
Feb 6th, 2005, 03:41 PM
#2
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.
ØØ
-
Feb 6th, 2005, 04:11 PM
#3
Thread Starter
PowerPoster
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
-
Feb 6th, 2005, 06:23 PM
#4
transcendental analytic
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.
-
Feb 7th, 2005, 04:54 AM
#5
Fanatic Member
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 
-
Feb 7th, 2005, 07:58 AM
#6
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
-
Feb 7th, 2005, 01:25 PM
#7
Addicted Member
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
-
Feb 8th, 2005, 01:01 AM
#8
Thread Starter
PowerPoster
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
-
Feb 8th, 2005, 09:58 AM
#9
Re: Calc Perpendicular (sp?) Vector
 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.
-
Feb 8th, 2005, 11:49 AM
#10
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|