*
This commit is contained in:
@@ -27,7 +27,7 @@ public class CrossHair : MonoBehaviour {
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
var ray = camera.ViewportPointToRay (new Vector3(0.5f,0.5f,0.0f));
|
||||
var ray = GetComponent<Camera>().ViewportPointToRay (new Vector3(0.5f,0.5f,0.0f));
|
||||
hasHit = Physics.Raycast (ray, out hit);
|
||||
if (hasHit) {
|
||||
target = hit.point;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CrossbowArrow : MonoBehaviour {
|
||||
hitName = "HitGlass";
|
||||
}
|
||||
|
||||
GameObject hitObjSrc = physicsHits.transform.FindChild(hitName).gameObject;
|
||||
GameObject hitObjSrc = physicsHits.transform.Find(hitName).gameObject;
|
||||
GameObject hitObj = (GameObject)Instantiate(hitObjSrc);
|
||||
hitObj.transform.localPosition = hit.point;
|
||||
hitObj.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PlayerController : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
cameraObject = gameObject.transform.FindChild ("Camera").gameObject;
|
||||
cameraObject = gameObject.transform.Find ("Camera").gameObject;
|
||||
rotateUpDown = transform.localEulerAngles.x;
|
||||
rotateLeftRight = transform.localEulerAngles.y;
|
||||
c = gameObject.GetComponent<CharacterController> ();
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections;
|
||||
|
||||
public class Utils {
|
||||
public static GameObject FindChildRecursive(GameObject obj, string name){
|
||||
var child = obj.transform.FindChild (name);
|
||||
var child = obj.transform.Find (name);
|
||||
if (child != null) {
|
||||
return child.gameObject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user