my question is in the title, please help! when i look in the game view its just blue!
p.s. plz dont reply with the code kind of thing unless you want to tell me what it is and what to do with it. i have no clue
my question is in the title, please help! when i look in the game view its just blue!
p.s. plz dont reply with the code kind of thing unless you want to tell me what it is and what to do with it. i have no clue
ran into the same problem and this is the solution i came up with...
//cast two raycasts and get the distance of each
//pntA is an empty gameobject that should be parented and placed in front
// of the camera. pntB should be behind. distA is the distance from first
// raycast, distB is the second.
var hitA : RaycastHit;
var pntA : Transform;
var distA = 0.0;
var hitB : Raycast;
var pntB : Transform;
var distB = 0.0;
if (Physics.Raycast (pntA.position, -Vector3.up, hitA)) {
distA = hitA.distance;
Debug.DrawLine(pntA.position,hitA.point);
}
var hitB : RaycastHit;
if(Physics.Raycast ( pntB.position,-Vector3.up, hitB)){
distB = hitB.distance;
Debug.DrawLine(pntB.position,hitB.point);
}
//if distA is greater than distB rotate till they are equal and visa versa.
if(distA>distB+.2){
transform.Rotate(Vector3(80,0,0)*Time.deltaTime);
}
if(distA<distB-.2){
transform.Rotate(Vector3(-80,0,0)*Time.deltaTime);
}
//if you want more than one axis alignment add more raycasts.