You are on page 1of 1

using System.

Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour


{
float h;
float v;
Vector3 mover;
[SerializeField] float speed = 3;
[SerializeField] Transform Mira;
[SerializeField] Camera Camara;
Vector2 direc;
// [SerializeField] float speed = 3;
// Start is called before the first frame update
void Start()
{

// Update is called once per frame


void Update()
{
h = Input.GetAxis("Horizontal");
v = Input.GetAxis("Vertical");
mover.x = h;
mover.y = v;
// print(h);
// print(v);
transform.position += mover * Time.deltaTime * speed;
//transform.position += mover * Time.deltaTime * speed;

//Movimiento del jugador


//Mira.position = Camara.ScreenToWorldPoint(Input.mousePosition);
direc = Camara.ScreenToWorldPoint(Input.mousePosition) -
transform.position;
Mira.position = transform.position + (Vector3)direc.normalized;

}
}

You might also like