Home Artists Posts Import Register

Content

This script let's you automatically teleport any object if a player walks into an area for example


"Moving towards this area unhides this object or Teleport this object".

Take the door example from the other door, But now it's an automatic door that does not require user input.

Now when the player steps close to the door, The player also steps into a hidden object with a trigger that also does whatever you want in the script below.

Have fun


public class "FileName" : UdonSharpBehaviour

{

    public GameObject[] targets;


    public override void OnPlayerTriggerEnter(VRCPlayerApi player) {

    {

        if(player != null && player.isLocal){ 

        for (int i = 0; i < targets.Length; i++)

        {

            targets[i].transform.position = new Vector3(X,Y,Z);

            targets[i].transform.rotation = Quaternion.Euler(X,Y,Z);

            targets[i].transform.localScale = new Vector3(X,Y,Z);

        }}

    }

}}

Comments

No comments found for this post.