- Home /
Question by
fatihmert1995 · Jun 14, 2013 at 06:28 PM ·
c#gameobjectplaneconvert
Cannot convert type `UnityEngine.GameObject' to `UnityEngine.Plane'
I must use to class Plane of Raycast method but, I see the error Cannot convert type UnityEngine.GameObject' to
UnityEngine.Plane'
Plane oyuncuZemin = (Plane)GameObject.Find("Plane");
I can compile the code;
Plane oyuncuZemin = new Plane(Vector3.up,transform.position);
but, previously created on the box collider with plane, running thw wrong code..
Thank you for interest. Good works..
Comment
Best Answer
Answer by Coderdood · Jun 14, 2013 at 06:40 PM
GameObject.Find returns a GameObject. The Plane used in Raycast is a struct. There is a plane primitive you can create in Unity but that is different and is simply a flat mesh - not an actual mathematical plane which is what you need.
The answer to this question explains more.
Hey, sorry but I don't know how to use that answer. Can you explain how I create a UnityEngine.Plane Plane from the UnityEngine.Gameobject Plane?