Quantcast
Channel: Questions in topic: "contact"
Viewing all articles
Browse latest Browse all 75

Why is collision.contacts causing a compiler error

$
0
0
I am new to Unity Programming so the compiler error has me stumped. Any help is appreciated. My Code is meant to make a ball reflect, but it is giving me a compiler error on line 11 at collision.contacts. Could anyone tell me what is wrong, because this is what the scripting reference did. I have also tried this with various types of capitalization. The Compiler's Error is: " 'Collision' does not contain a definition for 'contacts' accepting a first argument of the type 'Collision' could be found" ![alt text][1] Thanks The code is: using UnityEngine; using System.Collections; public class Collision : MonoBehaviour { public Vector3 move; void Update () { transform.Translate(move); } void OnCollisionEnter (Collision collision) { ContactPoint contact = collision.contacts[0]; Vector3.Reflect( move, contact.normal); print("Collision is working!"); } [1]: /storage/temp/1799-capture.png

Viewing all articles
Browse latest Browse all 75

Trending Articles



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