Quantcast
Channel: Questions in topic: "stay"
Viewing all articles
Browse latest Browse all 18

Input Issue-- Won't stay in proper setting (Javascript)

$
0
0

Well once again I am having issues as a beginner developer. This time the code works up until the point when the vehicle is mounted. It will mount for a split second then send out the debug "off" again. Help?

function OnTriggerStay(other : Collider) {
    if (other.tag == "Player1") {
        if(Input.GetButtonDown("Mount1")) {
            if(mounted) {
                player1.GetComponent("Player1Move").enabled = true;
                target.GetComponent("P1MountMove").enabled = false;
                player1.parent = null;
                Debug.Log("off");
                if(mount == player1) {
                    mounted = false;
                    mount = null;
                }
            } else {
                mounted = true;
                player1.position = seat.position;
                player1.LookAt(faceObject);
                player1.GetComponent("Player1Move").enabled = false;
                target.GetComponent("P1MountMove").enabled = true;
                player1.parent = target;
                mount = player1;
                Debug.Log("on");
            }
        }
    }

Viewing all articles
Browse latest Browse all 18

Trending Articles



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