Advertisement
epitaque_

Untitled

Oct 10th, 2015
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. HERO_ANGLES = {} -- this is a workaround to the SetAngles problem. by keeping a record of the angles myself
  2. -- I don't have to worry about them getting set to something else on the next frame. however, it does cause some twitchiness
  3. -- when something (I don't know what) overrides the angles of the unit after I do my SetAngles using HERO_ANGLES
  4.  
  5. function GameMode:MouseMove(info)
  6.     local playerID = info.PlayerID
  7.     local hero = PlayerResource:GetSelectedHeroEntity(playerID)
  8.     local x = info.difX
  9.     local y = info.difY
  10.  
  11.     if type(x) ~= "number" or x == nil then
  12.         return
  13.     end
  14.  
  15.     local angles = hero:GetAnglesAsVector()
  16.  
  17.     if not HERO_ANGLES[playerID] then
  18.         HERO_ANGLES[playerID] = angles
  19.     end
  20.  
  21.     HERO_ANGLES[playerID] = Vector(GameMode:ClampPitch(HERO_ANGLES[playerID].x + (y/5) ), HERO_ANGLES[playerID].y + (x/2.5), HERO_ANGLES[playerID].z)
  22.  
  23.     --hero:SetAngles(angles.x + (y/3), angles.y + (y/2.5), angles.z) here was my code before the workaround where I didn't keep track of the angles myself and I used the game's GetAnglesAsVector
  24.     hero:SetAngles(HERO_ANGLES[playerID].x, HERO_ANGLES[playerID].y, HERO_ANGLES[playerID].z)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement