Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void UpdateWithMouse() {
- //// vars ////
- float minY,
- maxY,
- focusAngle = Player.FocusAngle,
- focusToMinY,
- focusToMaxY,
- mouseX = Input.GetAxis("Mouse X"),
- mouseY = Input.GetAxis("Mouse Y"),
- lookSpeed = GameProperties.LookSpeed,
- angleX,
- angleY;
- //// work ////
- // assign current rotation limits
- if(Player.CurLocation.UseRotLimits) {
- minY = Player.CurLocation.RotLimits.z;
- maxY = Player.CurLocation.RotLimits.w;
- }
- else {
- minY = GameProperties.RotMinY;
- maxY = GameProperties.RotMaxY;
- }
- // assign 'focusTo' vars
- focusToMinY = focusAngle - minY;
- focusToMaxY = focusAngle - maxY;
- // find angleX & angleY
- angleX = mouseX * lookSpeed;
- angleY = mouseY * lookSpeed;
- angleY = Mathf.Clamp(angleY, focusToMinY, focusToMaxY);
- // rotate Focus around player
- Player.Focus.RotateAround(Player.Pos, Player.Right, angleY);
- Player.Focus.RotateAround(Player.Pos, Player.Up, angleX);
- // make Player look at his FocusPoint
- Player.Obj.LookAt(Player.FocusPos);
- }
Add Comment
Please, Sign In to add comment