Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using UnityEngine;
- namespace Assets.TransitionMaster.Scripts
- {
- public class CharacterControllerTest :MonoBehaviour
- {
- public float Z;
- public float HorizontalSpeed = 10;
- public float Jump = 10;
- public void Start()
- {
- this.rigidbody.freezeRotation = true;
- }
- public void Update()
- {
- this.transform.position = new Vector3(this.transform.position.x,this.transform.position.y,Z);
- var h = Input.GetAxis("Horizontal");
- this.rigidbody.velocity += Vector3.right*h * HorizontalSpeed * Time.deltaTime;
- if (Input.GetKey(KeyCode.Space))
- {
- this.rigidbody.velocity += Vector3.up*Jump;
- }
- //Remove this to change the camera this is just for testing
- }
- public void LateUpdate()
- {
- Camera.main.transform.position = this.transform.position - 20*Vector3.forward;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement