Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

Why does my code not work?

$
0
0
public float rotatorSpeed; public float rotatorTrigger = 0f; Vector3 rotatorLocation; void OnTriggerEnter(Collider triggerData) { if (triggerData.tag == "Rotator") { rotatorTrigger = 1; rotatorLocation = triggerData.gameObject.transform.position; playerControl.enabled = false; } } void Update() { if (rotatorTrigger == 1) { transform.position = Vector3.Lerp(transform.position, rotatorLocation, rotatorSpeed * Time.deltaTime); Debug.Log("OK"); } } ---------- **I checked the following.** ---------- - Target object has "Rotator" tag. - **OnTriggerCollision** sets **rotatorTrigger** to **1**, but if statement still wont execute. - I don't see "OK" in the log.

Viewing all articles
Browse latest Browse all 827

Trending Articles



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