mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Do not clip players with hook in the field of view
This commit is contained in:
parent
d64445d983
commit
ab37f95bb4
|
@ -147,11 +147,11 @@ typedef vector2_base<int> ivec2;
|
|||
template<typename T>
|
||||
inline bool closest_point_on_line(vector2_base<T> line_pointA, vector2_base<T> line_pointB, vector2_base<T> target_point, vector2_base<T> &out_pos)
|
||||
{
|
||||
vector2_base<T> AP = target_point - line_pointA;
|
||||
vector2_base<T> AB = line_pointB - line_pointA;
|
||||
T SquaredMagnitudeAB = dot(AB, AB);
|
||||
if(SquaredMagnitudeAB > 0)
|
||||
{
|
||||
vector2_base<T> AP = target_point - line_pointA;
|
||||
T APdotAB = dot(AP, AB);
|
||||
T t = APdotAB / SquaredMagnitudeAB;
|
||||
out_pos = line_pointA + AB * clamp(t, (T)0, (T)1);
|
||||
|
|
|
@ -1191,7 +1191,8 @@ void CCharacter::Snap(int SnappingClient)
|
|||
if(!Server()->Translate(ID, SnappingClient))
|
||||
return;
|
||||
|
||||
if(NetworkClipped(SnappingClient) || !CanSnapCharacter(SnappingClient))
|
||||
// A player may not be clipped away if his hook is in the field of view
|
||||
if(NetworkClippedLine(SnappingClient, m_Pos, m_Core.m_HookPos) || !CanSnapCharacter(SnappingClient))
|
||||
return;
|
||||
|
||||
SnapCharacter(SnappingClient, ID);
|
||||
|
|
Loading…
Reference in a new issue