Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Feliponcio : MonoBehaviour {
- public Vector2 [] Movimientos;
- public float _velocity;
- public Vector2 PosInicial;
- public float _magnitud;
- public Vector2 _resultante;
- // Use this for initialization
- void Start()
- {
- PosInicial = transform.position;
- for (int i = 0; i < Movimientos.Length; i++)
- {
- _resultante += Movimientos[i];
- }
- _magnitud = Mathf.Sqrt(Mathf.Pow(_resultante.x, 2)+ Mathf.Pow(_resultante.y, 2));
- }
- // Update is called once per frame
- void Update()
- {
- transform.position = Vector3.MoveTowards(transform.position, PosInicial + _resultante, _velocity * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement