Search Unity

Simple script

Discussion in 'VR' started by e1e1e1, Jan 11, 2019.

  1. e1e1e1

    e1e1e1

    Joined:
    Jan 11, 2019
    Posts:
    58
    Hey,
    Im very new in unity and i tried to find a tutorial explaining how to move from one point in the scene to another buy stepping on empty object or defined area and didnt find.

    What im willing to do is to move in the scene with Android device and vr glass (by looking down) and when i stepping in some point in the scene its transfer me to another defined point in the scene (like top of a mountain)..can anyone help?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    How exactly are you "stepping" around in the scene? What does that mean in your case?

    And while it may not be relevant, what is "vr glass"?
     
  3. e1e1e1

    e1e1e1

    Joined:
    Jan 11, 2019
    Posts:
    58
    lets say my player just walking around forest scene and when he walking to defined point in the scene its transfer him to another point in the scene...

    and Virtual Reality Glasses
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    OK, my question was unclear. I'm asking how you have the player walking around. What script or asset are you using to accomplish this? What does the player manipulate on some controller or input device to cause it to happen? Under the hood, is it using the stock PlayerController prefab from Unity? Or an asset out of VRTK? Is it using a NavMesh, or casting rays, or something else? Smooth movement or teleportation?

    I guarantee the player is not actually walking around a real forest. So tell me what the player is actually doing, and how this works, and I may be able to suggest how to hook into that for what you want to do.

    Also, there is no such thing as Virtual Reality Glasses. You are using a Cardboard viewer with an Android phone. Or you are using Oculus Go. Or perhaps a Vive or a Rift headset. Which one it is might matter. Why are you making us guess?

    The short and generic answer is, add a trigger to your scene, and when the trigger is triggered, assign a new position to the player. But to give you a more specific answer, you first need to provide some specifics about your situation.
     
  5. e1e1e1

    e1e1e1

    Joined:
    Jan 11, 2019
    Posts:
    58
    I'm about 4 days in unity and unfamiliar with all of the terms. this is the script using to walk



    this is all I have actually, exactly like in this video, terrain and walking. so what im trying to do is some point or station in this terrain that if I step in it, it transfer me to other part of the terrain
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    OK, it looks like you're using Cardboard VR with some kind of smart phone, and you've got a "look walk" script — pretty interesting, I've never seen that particular approach before.

    You're moving on a Terrain, with a TerrainCollider. And you've put a CharacterController on the main camera; that's the component that actually moves you around.

    OK! So next you need to learn about triggers. Go do this tutorial, and try to combine it with what you have so far. Let us know if you get stuck!