Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

Virtual tour - teleporting not working

$
0
0
I am developing a project in Unity that works like a virtual tour in a building. Basically, it starts with the 3D model with some interectable buttons in it. When the user clicks in these buttons, it is teleported to the center of a sphere with a 360 image of the building as a texture. The main problem is with the teleport script, because I also have attached to the player a free flight controller. When I'm in play mode, if I don't move the player (through the free flight controller) the teleporting works fine (the player is teleported to the sphere). But if I move de player, seems like it gets other position as reference, and teleport to a random place. Ps.: I'm using the WebXR Camera Set available in Unity Asset Store (WebXR exporter), so it can be visualized in a web page (wegGL export mode). Anyone had a similar problem and knows how to help me??? Its for a research project and I really don't know what else to do. For now, this is my teport script: using System.Collections; using System.Collections.Generic; using UnityEngine; using WebXR; public class Teleporting : MonoBehaviour { public GameObject Player; public Transform teleportSphere; public Vector3 startPosition; public GameObject MainCamera; void Start() { MainCamera = GameObject.Find("CameraMain"); DesertFreeFlightController dffc = MainCamera.GetComponent(); dffc.enabled = true; startPosition = new Vector3(0, 0, 0); } void OnMouseDown() { Debug.Log(transform.position); MainCamera = GameObject.Find("CameraMain"); DesertFreeFlightController dffc = MainCamera.GetComponent(); dffc.enabled = false; Player.transform.position = teleportSphere.transform.position; dffc.enabled = true; dffc.translationEnabled = false; dffc.rotationEnabled = true; } }

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>