--
[ 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

Reply via email to