Code: Select all

```
function Timer()
{
if (Enemy == none || Enemy.bDeleteMe || Enemy.Health <= 0)
EnemyNotVisible();
else
{
DesiredRotation = rotator(Enemy.Location - Location);
DesiredRotation.Yaw = DesiredRotation.Yaw & 65535;
if (LineOfSightTo(Enemy))
{
if (bFired && DesiredRotation.Pitch < 2000 &&
(Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) < 1000 ||
Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) > 64535))
{
Shoot();
}
else
{
bFired = true;
SetTimer(FireRate, true);
}
}
}
}
```

Code: Select all

```
DesiredRotation = rotator(Enemy.Location - Location);
DesiredRotation.Yaw = DesiredRotation.Yaw & 65535;
if (LineOfSightTo(Enemy))
{
if (bFired && DesiredRotation.Pitch < 2000 &&
(Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) < 1000 ||
Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) > 64535))
```

**>>>>>>>>>>>>>>>>>>>>**

Mobile edit:

It just occured to me that the value 65535 is 256^2, is this the extent of what the rotational value of an object can reach before it goes back to 0?

>>>>>>>>>>>>>>>>>>>>

Mobile edit:

It just occured to me that the value 65535 is 256^2, is this the extent of what the rotational value of an object can reach before it goes back to 0?

>>>>>>>>>>>>>>>>>>>>

On a related note, found something for determining relative rotation, though it appears to only covers four angles of an actor.

https://forums.unrealengine.com/showthr ... ite-system

Code: Select all

```
Sprite A if , Dot(Enemy forward vector , (playerLocation - EnemyLocation).Normalized) >0.7
Sprite D if , Abs( Dot(Enemy forward vector ,(playerLocation - EnemyLocation).Normalized) )<0.7 && Dot(enemy Right Vectorc,(playerLocation - EnemyLocation).Normalized)<0
Sprite B if ,Abs( Dot(Enemy forward vector ,(playerLocation - EnemyLocation).Normalized) )<0.7 && Dot(enemy Right Vectorc,(playerLocation - EnemyLocation).Normalized)>0
Sprite C if , Dot(Enemy forward vector,(playerLocation - EnemyLocation).Normalized) <-0.7
```