Advertisement
JademusSreg

Get Relative Angle

Apr 19th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. fixed ThirdPerson_GetRelativeAngle (int player)
  2. {
  3.     fixed yaw = CameraGetYaw(player);
  4.     //fixed face = UnitGetFacing(playerAssets[player].units.avatar);
  5.     fixed up = IntToFixed(MaxI(BoolToInt(playerInput[player].key.state[c_keyW]),BoolToInt(playerInput[player].key.state[c_keyUp])));
  6.     fixed down = IntToFixed(MaxI(BoolToInt(playerInput[player].key.state[c_keyS]),BoolToInt(playerInput[player].key.state[c_keyDown])));
  7.     fixed left = IntToFixed(MaxI(BoolToInt(playerInput[player].key.state[c_keyA]),BoolToInt(playerInput[player].key.state[c_keyLeft])));
  8.     fixed right = IntToFixed(MaxI(BoolToInt(playerInput[player].key.state[c_keyD]),BoolToInt(playerInput[player].key.state[c_keyRight])));
  9.     fixed atan = ATan2(up - down, right - left);
  10.     return (yaw+atan);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement