Guest User

Untitled

a guest
Nov 2nd, 2018
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. namespace FIMSpace.GroundFitter
  4. {
  5.     /// <summary>
  6.     /// FM: Example component to use groud fitter for movement controller
  7.     /// </summary>
  8.     public class FGroundFitter_MovementLook : FGroundFitter_Movement
  9.     {
  10.         public Transform targetOfLook;
  11.  
  12.         protected override void HandleTransforming()
  13.         {
  14.             base.HandleTransforming();
  15.             if ( MoveForward ) SetLookAtPosition(transform.position + Quaternion.Euler(0f, Camera.main.transform.eulerAngles.y + RotationOffset, 0f) * Vector3.forward * 10f);
  16.         }
  17.  
  18.         protected virtual void SetLookAtPosition(Vector3 tPos)
  19.         {
  20.             if ( targetOfLook) targetOfLook.position = tPos + Vector3.up;
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment