Forum Discussion
craigotronprime
8 years agoHonored Guest
How do you fix a teleportation point in space relative to a moving object?
I slapped a teleportation point as the child of a sphere, which I can move around my scene and teleport to, but there are still a few issues to work through:
- the ColumnGlow of the teleportation point swings around wildly as the ball rolls around the scene.
- the orientation of the player following teleportation is the same as the sphere, so it's basically random and very disorienting.
- If the ball rolls out of sight, you can't teleport at all.
Ideally, I'd like to lose ColumnGlow altogether and have a press of the A button teleport the player to a spot just slightly off to a side of the ball.
I assume this is a pretty easy thing, but I'm a terrible coder, so I thought I'd seek out a little help.
Thanks in advance!
- the ColumnGlow of the teleportation point swings around wildly as the ball rolls around the scene.
- the orientation of the player following teleportation is the same as the sphere, so it's basically random and very disorienting.
- If the ball rolls out of sight, you can't teleport at all.
Ideally, I'd like to lose ColumnGlow altogether and have a press of the A button teleport the player to a spot just slightly off to a side of the ball.
I assume this is a pretty easy thing, but I'm a terrible coder, so I thought I'd seek out a little help.
Thanks in advance!
- If you're only changing the player's transform.position and not rotation, the player's rotation won't change.
- I'm guessing another script is calling the GetDestTransform function from this script? Over in that other script is where a change would need to be made...
8 Replies
Replies have been turned off for this discussion
- craigotronprimeHonored GuestI managed to get rid of ColumGlow just by unticking the Mesh Renderer. Now Ijust need to fix the orientation of the teleport point and make teleportation line-of-sight independent. Any help is mightily appreciated.
- weasel47Heroic ExplorerI don't know what ColumnGlow is, but....
If you have an object in the position you want the player to teleport to, all you have to do is change the player's transform.position by setting it equal to the other object's transform.position - craigotronprimeHonored GuestI will try this, but I think this is essentially how Oculus' teleport script works, and I think I'll run into the same problem. Since the player is following a ball, the player rotation after teleport is the same as the ball, which is to say essentially random. I think I need to use a Vector3 to counteract this, but I'm not entirely sure, and I'm always glacially slow at coding, but I make up for it by also being bad at it. Does using a Vector3 sound like a possible solution to you?
- weasel47Heroic ExplorerIf you're only changing the player's transform.position and not rotation, the player's rotation won't change.
- craigotronprimeHonored GuestI appreciate your help, but I'm having no luck so far. The script itself is very straightforward. Maybe you could tell me which line to add the transform.position? I've tried all the things I think would work, and have gotten it wrong every time. Here's the script Oculus uses for its Teleport points:using UnityEngine;using System.Collections;public class TeleportPoint : MonoBehaviour {public float dimmingSpeed = 1;public float fullIntensity = 1;public float lowIntensity = 0.5f;public Transform destTransform;private float lastLookAtTime = 0;// Use this for initializationvoid Start () {}public Transform GetDestTransform(){return destTransform;}// Update is called once per framevoid Update () {float intensity = Mathf.SmoothStep(fullIntensity, lowIntensity, (Time.time - lastLookAtTime) * dimmingSpeed);GetComponent<MeshRenderer>().material.SetFloat("_Intensity", intensity);}public void OnLookAt(){lastLookAtTime = Time.time;}}
Simple, right? Just not for me. - weasel47Heroic ExplorerI'm guessing another script is calling the GetDestTransform function from this script? Over in that other script is where a change would need to be made...
- craigotronprimeHonored GuestYep. Totally correct. I found the function in another script, commented out the line dealing with rotation, and now I'm 90% of the way to having it working to my satisfaction. Thanks so much! You're a hero!
- weasel47Heroic ExplorerYou're welcome, I'm glad I could help!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 8 months ago
- 1 year ago