SHARE
TWEET

Untitled

flowxed Apr 23rd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class runPos : MonoBehaviour {
  6.     public Vector3 run;
  7.     public Vector3 normal;
  8.     public Vector3 rotRun;
  9.     public Vector3 rotNormal;
  10.     public float runSpeed = 10;
  11.  
  12.     // Update is called once per frame
  13.     void Update () {
  14.         if (Input.GetKeyDown (KeyCode.LeftShift)) {
  15.             transform.localPosition = run
  16.             transform.localRotation = Quaternion.Lerp (transform.localRotation, Quarternion.Euler (rotRun), Time.deltatime*runSpeed);
  17.         }
  18.         if (Input.GetKeyUp (KeyCode.LeftShift)) {
  19.             transform.localPosition = normal;
  20.             transform.localRotation = Quaternion.Lerp (transform.localRotation, Quarternion.Euler (rotNormal), Time.deltatime*runSpeed);
  21.         }
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top