Quantcast
Channel: Answers by "Althaen"
Viewing all articles
Browse latest Browse all 33

Answer by Althaen

$
0
0
All I did was make clicking on the terrain in the InputManager use SendMessage to send the lasthit recorded from the NGUI raycast to movePlayer() in the MovementManager by using UICamera.lastHit.point as the target position. Input: using UnityEngine; using System.Collections; public class InputManager : MonoBehaviour { public GameObject terrain; private void Awake() { UIEventListener.Get(terrain).onClick += terClick; } public void terClick(GameObject terrain) { gameObject.SendMessage("movePlayer"); } } Movement: using UnityEngine; using System.Collections; public class MovementManager : MonoBehaviour { public void movePlayer() { iTween.MoveTo(gameObject,iTween.Hash("position",UICamera.lastHit.point,"speed",4f,"orienttopath",true,"easetype","linear","looktime",2f,"axis", "y")); } }

Viewing all articles
Browse latest Browse all 33

Trending Articles