- Home /
Question by
phxmichael · Jun 13, 2015 at 01:25 PM ·
functionclassparameters
Not sure why my function isn't working right.
So the goal here is to draw two rays downward, the problem i think has something todo with the parameters for my doubleRaycastDown function. Im still relatively new to programming so any advice or answer as to why this won't work would be greatly appreciated since its 2:51am and I have semi given up hope on finding the solution =_=
void Update () { doubleRaycastDown(myRayLength); }
bool doubleRaycastDown (TerrainMovementRayProperties myRayProp, float rayLength, out RaycastHit leftHitInfo, out RaycastHit rightHitInfo)
{
Vector3 transformUp = myTransform.up;
Vector3 transformRight = myTransform.right;
Ray leftRay = new Ray(myTransform.position + myRayProp.orginOffsetY * transformUp + myRayProp.distanceFromCenter);
Ray rightRay = new Ray(myTransform.position + myRayProp.orginOffsetY * transformUp - myRayProp.distanceFromCenter);
Debug.DrawRay(leftRay, Color.blue);
Debug.DrawRay(rightRay, Color.black);
return Physics.Raycast (leftRay, out leftHitInfo, out rayLength) && Physics.Raycast (rightRay, out rightHitInfo, out rayLength);
}
Comment