Created
June 24, 2022 12:26
-
-
Save pr00thmatic/09a98605a024892c88d68f96d133f304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class MovimientoDelHeroe : MonoBehaviour { | |
[Header("Initialization")] | |
public Camera cam; | |
[Header("Information")] | |
public float speed = 30; // m/s | |
void Reset () { | |
cam = Camera.main; | |
} | |
void Update () { | |
Vector3 right = cam.transform.right; | |
Vector3 forward = cam.transform.forward; | |
right.y = forward.y = 0; | |
transform.position += | |
( right * Input.GetAxis("Horizontal") + | |
forward * Input.GetAxis("Vertical")) * speed * Time.deltaTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment