Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UnityEngine;
  6.  
  7. namespace Assets.TransitionMaster.Scripts
  8. {
  9. public class CharacterControllerTest :MonoBehaviour
  10. {
  11.  
  12. public float Z;
  13. public float HorizontalSpeed = 10;
  14. public float Jump = 10;
  15.  
  16. public void Start()
  17. {
  18. this.rigidbody.freezeRotation = true;
  19. }
  20. public void Update()
  21. {
  22.  
  23. this.transform.position = new Vector3(this.transform.position.x,this.transform.position.y,Z);
  24.  
  25. var h = Input.GetAxis("Horizontal");
  26.  
  27. this.rigidbody.velocity += Vector3.right*h * HorizontalSpeed * Time.deltaTime;
  28.  
  29. if (Input.GetKeyDown(KeyCode.Space))
  30. {
  31. this.rigidbody.velocity += Vector3.up*Jump;
  32. }
  33.  
  34. //Remove this to change the camera this is just for testing
  35.  
  36. }
  37.  
  38. public void LateUpdate()
  39. {
  40. Camera.main.transform.position = this.transform.position - 20*Vector3.forward;
  41. }
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement