I always get range of errors if i try to put
var PointA = transform.TransformPoint(Vector3(0.5, -0.5, 0.5));
and set PointA insted transform.position
i even tryed to whitout defining var and isted just puting transform.TransformPoint(Vector3(0.5,-0.5,0.5)) isted transform.position
Hope anybody gets my point i want to shoot ray from specific position
would like some input
using UnityEngine;
using System.Collections;
public class ReycastingSuspension : MonoBehaviour {
public float RaycastDistance;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
//defines HitColector and executes ray
RaycastHit hitColector;
if (Physics.Raycast (transform.position, -transform.up, out hitColector,RaycastDistance))
// to see ray in editor and ray distance in console
Debug.DrawRay (transform.position,-transform.up,Color.green);
Debug.Log (hitColector.distance);
}
}
The above is C#. While the ‘var’ keyword is available, most people explicitly declare the variable. In addition, you need a ‘new’ keyword in front of the Vector3() construction, and you need to explicitly cast your numbers to floats. So it will look something like:
Vector3 pointA = transform.TransformPoint(new Vector3(0.5f, -0.5f, 0.5f));
and in context:
using UnityEngine;
using System.Collections;
public class ReycastingSuspension : MonoBehaviour {
public float RaycastDistance;
// Update is called once per frame
void Update ()
{
//defines HitColector and executes ray
Vector3 pointA = transform.TransformPoint(new Vector3(0.5f, -0.5f, 0.5f));
RaycastHit hitColector;
if (Physics.Raycast (pointA, -transform.up, out hitColector,RaycastDistance))
// to see ray in editor and ray distance in console
Debug.DrawRay (transform.position,-transform.up,Color.green);
Debug.Log (hitColector.distance);
}
}
i kinda solved but think this isent right wey to do bu i expanded colider box of object on y axis whit to 1.2