- Home /
 
               Question by 
               gmamafilms · Aug 20, 2016 at 09:41 AM · 
                scripting problemobjectvrteleportlook  
              
 
              how to make teleporting marker
I made a teleport script so that when you click you teleport to the object your looking at, but I want to make a particle system kind of like the orbital strike from Battlefront where there is a circle that follows where you look and can tell you where you're going to teleport.
using UnityEngine; using System.Collections;
public class LookTele : MonoBehaviour {
 private RaycastHit lastRaycastHit;
 public AudioClip audioClip;
 // Use this for initialization
 void Start () {
     Cursor.visible = false;
 }
 private GameObject GetLookedAtObject(){
     Vector3 origin = transform.position;
     Vector3 direction = Camera.main.transform.forward;
     float range = 1000;
     if (Physics.Raycast (origin, direction, out lastRaycastHit, range))
         return lastRaycastHit.collider.gameObject;
     else
         return null;
 }
 private void TeleportToLookAt(){ 
     transform.position = lastRaycastHit.point + lastRaycastHit.normal * 2;
     if (audioClip != null)
         AudioSource.PlayClipAtPoint (audioClip, transform.position);
 }
     // Update is called once per frame
 void Update () 
 {
 if (Input.GetButtonDown ("Fire1"))
         if (GetLookedAtObject  () != null)
             TeleportToLookAt ();
 }
}
any help is great.
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
I created a look to teleport script and I'm falling through the level 2 Answers
2D - Creating a basic teleport system 0 Answers
Play a sound when i look at a certain object? 1 Answer
The best way to sort list of gameobjects in order I need? 0 Answers
Why isn't my teleport on collision script working? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                