Open sidebar
using System.Collections; using System.Collections.Generic; using UnityEngine; public class RecievedMovement : MonoBehaviour { Vector3 newposition; public float speed; public float walkRange; public GameObject graphics; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Vector3.Distance(newposition, this.transform.position) > walkRange) { this.transform.position = Vector3.MoveTowards(this.transform.position, newposition, speed * Time.deltaTime); Quaternion transRot = Quaternion.LookRotation(newposition - this.transform.position, Vector3.up); graphics.transform.rotation = Quaternion.Slerp(transRot, graphics.transform.rotation, 0.7f); } } [PunRPC] public void RecievedMove(Vector3 movePos) { newposition = movePos; } }
Close sidebar
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting