I found some scripts in forums, but it works only for static things. Pawns changes their rotation to player, and this solution doesn't work.
Code: Select all
simulated function Tick(float deltatime)
{
local PlayerPawn P;
local byte TextureIndex;
local rotator r;
foreach RadiusActors(class'PlayerPawn', P, RadiusCheck, Location ){ //player is in radius
if(Viewport(P.Player) != None){ // find local client player.
if(P.ViewTarget == none){
r = rotator(P.Location - self.location);
if (r.yaw <= +4096 && r.yaw > -4096)
TextureIndex = 0;
else if (r.yaw <= -4096 && r.yaw > -12288)
TextureIndex = 2;
else if (r.yaw <= +12288 && r.yaw >+4096)
TextureIndex = 1;
else if (r.yaw <= -12288 && r.yaw > -20480)
TextureIndex = 4;
else if (r.yaw <= +20480 && r.yaw > +12288)
TextureIndex = 3;
else if (r.yaw <= -20480 && r.yaw > -28672)
TextureIndex = 6;
else if (r.yaw <= +28672 && r.yaw > +20480)
TextureIndex = 5;
else
TextureIndex = 7;
if (TextureIndex != CurrentTextureIndex)
{
CurrentTextureIndex = TextureIndex;
Texture = Sprites[CurrentTextureIndex];
}
}else{ // player view is from other actor
}
}
return;
}
}