mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 14:00:17 +00:00
aim toward head
This commit is contained in:
parent
fa825315d9
commit
167e313456
1 changed files with 6 additions and 1 deletions
|
@ -112,7 +112,7 @@ namespace SanAndreasUnity.Behaviours
|
|||
case PedAction.Chasing:
|
||||
if (this.TargetPed != null)
|
||||
{
|
||||
Vector3 diff = this.TargetPed.transform.position - this.MyPed.transform.position;
|
||||
Vector3 diff = GetHeadOrTransform(this.TargetPed).position - GetHeadOrTransform(this.MyPed).position;
|
||||
Vector3 dir = diff.normalized;
|
||||
if (diff.magnitude < 10f)
|
||||
{
|
||||
|
@ -151,6 +151,11 @@ namespace SanAndreasUnity.Behaviours
|
|||
}
|
||||
}
|
||||
|
||||
private static Transform GetHeadOrTransform(Ped ped)
|
||||
{
|
||||
return ped.PlayerModel.Head != null ? ped.PlayerModel.Head : ped.transform;
|
||||
}
|
||||
|
||||
private static PathNode GetNextPathNode(PathNode previousNode, PathNode currentNode)
|
||||
{
|
||||
var possibilities = new List<PathNode>();
|
||||
|
|
Loading…
Reference in a new issue