Hey guys, I have a little problem with my script, it seems to be impossible to let my first step of an Gravitationsystem Debug.Log the testmessage so that I can see that the Raycast between my Planet and the Player is working.
Becouse nothing is showing up I cant test it.
here you have the code:
var Player : GameObject;
var Planet : GameObject;
var hit : RaycastHit;
var ray : Ray;
function Update() {
Raycast = GraviRay = new Ray(Planet.transform.position, Player.transform.position);
if (GraviRay == true){
Debug.Log("Gravitation activated");
}
}
Any help for the Script would be good.
And btw… my 3 icons on the upper right of the console are marked. So that would not be the problem.
You are not raycasting anywhere in this code. You are just creating a ray object and storing it in 2 variables (that are not defined) Also the second parameter of the Ray constructor should be the direction, not endpoint of the ray
– NoseKills