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

Falling Object Trigger Problem

$
0
0
So I made a script in which when the player walks onto a trigger, it gives a boulder RigidBody2D and therefore making it fall. But it doesn't cause any movement in the boulder, and it doesn't check off a the Boolean I made that will be true when the boulder is falling. BTW, I am very new to unity and C#, but anyway, heres my script: using UnityEngine; using System.Collections; public class BoulderTrigger : MonoBehaviour { private Player player; public bool BoulderFallActive; public GameObject Boulder; void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent(); Boulder = GameObject.FindGameObjectWithTag("boulder"); } void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("Player")) { if (col.CompareTag("boulder")) { Boulder.AddComponent(); BoulderFallActive = true; } } } }

Viewing all articles
Browse latest Browse all 827

Trending Articles



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