mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-15 00:37:09 +00:00
refactor FindGroundParams
This commit is contained in:
parent
85cd5867a6
commit
a1751c7ba4
1 changed files with 10 additions and 3 deletions
|
@ -105,9 +105,16 @@ namespace SanAndreasUnity.Behaviours
|
||||||
public struct FindGroundParams
|
public struct FindGroundParams
|
||||||
{
|
{
|
||||||
public bool tryFromAbove;
|
public bool tryFromAbove;
|
||||||
|
public float raycastDistance;
|
||||||
|
|
||||||
|
public FindGroundParams(bool tryFromAbove = true, float raycastDistance = 1000)
|
||||||
|
{
|
||||||
|
this.tryFromAbove = tryFromAbove;
|
||||||
|
this.raycastDistance = raycastDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FindGroundParams DefaultBasedOnLoadedWorld => new FindGroundParams((null == Cell.Instance || Cell.Instance.HasExterior));
|
||||||
|
|
||||||
public static FindGroundParams Default => new FindGroundParams(){tryFromAbove = true};
|
|
||||||
public static FindGroundParams DefaultBasedOnLoadedWorld => new FindGroundParams(){tryFromAbove = (null == Cell.Instance || Cell.Instance.HasExterior)};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,7 +475,7 @@ namespace SanAndreasUnity.Behaviours
|
||||||
Vector3 t = this.transform.position;
|
Vector3 t = this.transform.position;
|
||||||
t.y = 150;
|
t.y = 150;
|
||||||
this.transform.position = t;
|
this.transform.position = t;
|
||||||
this.FindGround(FindGroundParams.Default);
|
this.FindGround(new FindGroundParams());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue