Instead of teleporting them to that position, you should trace their
bounding box to the position, and then set their new pos at the end of
the trace.

You can use TracePlayerBBox to do the trace, see gamemovement.cpp for
examples.

Matt

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jay C.
Sent: Monday, April 17, 2006 1:46 PM
To: [email protected]
Subject: RE: [hlcoders] Moving two players apart.

Wow, thanks a million Gary, appreciate the help. I'll go implement it
now.

While we're on the subject, do you know is there an existing function to
check if the player is allowed to move there without having to do Trace
Line to check for a wall?

Just in case there's a crate, or something else which they could get
stuck on.
The entire process is because, when I set a player model and they are in
close proximity to another player, the two get stuck together.
I'm using custom models which I'm unsure of their origin so it may be
something to do with them. Albeit this will hopefully rid myself of the
problem =)

- Jason Croghan

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:hlcoders-
> [EMAIL PROTECTED] On Behalf Of Garry Newman
> Sent: 17 April 2006 21:26
> To: [email protected]
> Subject: Re: [hlcoders] Moving two players apart.
>
> --
> [ Picked text/plain from multipart/alternative ] Vector v1 =
> Player1->GetAbsOrigin() Vector v2 = Player2->GetAbsOrigin()
>
> Vector v3 = v2 - v1
>
> v3 is now the vector between the two, v3.Distance() would return the
> distance between them
>
> v3.NormalizeInPlace()
>
> v3 is now the normal between the two
>
> v1 = v1 + (v3 * 128)
> v2 = v2 - (v3 * 128)
>
> That moves the players 128 units in the opposite direction (I might
> have got it the wrong way around).
>
> then it's just a case of Player1->SetAbsOrigin( v1 ) etc
>
>
> I think that makes sense anyway..
>
>
> On 4/17/06, Jay C. <[EMAIL PROTECTED]> wrote:
> >
> > Hey folks.
> >
> > Given two Vectors, if they are in too close a proximity, I want to
> > move one of them away from the other one.
> > I can already check if they are too close, it's the trig side of
> > finding out how to move them directly away from one another that I
> > can't get my head around.
> >
> > Vector vecDir = pInflictor->WorldSpaceCenter() -
> > pVictim->WorldSpaceCenter();
> >
> > Looks like a likely candidate but I'm unsure.
> >
> > If anyone could think of anything off hand I'd appreciate it.
> >
> > Thanks in advance.
> >
> > - Jason Croghan
> >
> >
> > _______________________________________________
> > 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


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

Reply via email to