Simply build the camera matrix directly.

You can build forward, up and right from just the "up" vector. The up
vector will be the normal of the wall and the "forward" vector will be
the direction the player is facing. To get the "right" vector, just
take the cross product of "up" CROSS "forward". Now you have the 3
basis vectors for the camera. And the position is some offset from the
wall. Perhaps the point on the wall w/ some offset from the "up"
vector.

Here's the math:

camera.forward = player.forward
camera.up = wall.normal
camera.right = camera.up CROSS camera.forward
camera.position = player.position + wall.normal * EYE_HEIGHT



On Thu, 6 Jan 2005 01:17:07 -0700, Hasan Aljudy <[EMAIL PROTECTED]> wrote:
> For manipulating the camera try looking at in_camera.cpp, ultimatly
> you would change m_vecCameraOffset which happens to be a vector but
> apparently (according to my humble understanding) it's used as an
> angle.
>
> I'll assume at this point the eye-angle is set as if the player is
> walking "normally" (i.e. you haven't altered it yet), this is the
> implication I get from your question.
>
> You can get the normal of the plane you'r moving on by doing something
> like a traceline and getting tr.plane.normal (something like that)
> then that would be the up vector.
> for the forward and right vectors, hmm .. I'm not so sure, maybe the
> experts will help you.
>
> I only have a rough idea: maybe grab these vectors (forward and right)
> the moment you change from walking "normally" to walking on walls,
> then adjust thier z component so that the vector lies on the plane of
> movement.
> You can probably do this with complex math, but I don't know, so this
> is what I do: make a point that's positioned slightly above the
> forward vector (treat the forward vector as a point for now) so that
> when you draw a line between these two points you either get a line
> parallel to the normal of the ground or the normal of the plane you're
> walking on, something like VectorMA(forward, 10, normal, newpoint)
> would do.
> Then, do a trace line from this newpoint to the forward point, the
> tr.endpos is probably the point on the plane that lies infront of the
> player, so the vector (tr.endpos - player->GetAbsOrigin() ) should be
> a good forward vector. You can use the same method to get a right
> vector I guess.
>
> I'm not sure if this is what you're asking. Beaware that my solution
> is a noob solution, I'm sure there is a more effecient method of doing
> it.
>
> /me hopes he hasn't embarresed himself.
>
> On Wed, 5 Jan 2005 21:54:00 -0800, Trauts <[EMAIL PROTECTED]> wrote:
> > This is a multi-part message in MIME format.
> > --
> > [ Picked text/plain from multipart/alternative ]
> > Basically, I coded a wall run movetype. However, I'd like to rotate the
> > camera so that it appears the wall they are running on is actually the floor
> > for them.
> >
> > I have a normal vector to the wall, and I'm sure I need it, but I'm not sure
> > how to get this to work.
> >
> > I think I have to use player->LocalEyeAngles() and player->SnapEyeAngles(),
> > but from there, I'm lost.
> >
> > --
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives, 
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to