Hello, its me ><>FreakFish<>< requesting your wisdom again! Today i’ve been having a bit of an issue with my Weeping Angels - the game is first person, and the Angels can only move when you cant see them. Here is my original script - its fully functional:
var LookAtTarget:Transform;
var damp = 5;
public var angel1speed = 1;
function FixedUpdate ()
{
if(LookAtTarget)
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
rigidbody.AddForce(transform.forward * angel1speed);
}
}
function OnMouseEnter ()
{
angel1speed = 0;
}
function OnMouseExit ()
{
angel1speed = 1;
}
That controls the Angel’s movement. My problem is that because i modelled the angel lying down i had to rotate it, then stick an invisible box on its feet that can host the script and keep the angel the right way up. It works fine, except you have to look at the angel’s feet where the invisible box is to make it stop. I tried to solve this problem by adding another invisible box that covers the correct area, then i wrote this script for it:
function OnMouseEnter ()
{
angel1speed = 0;
}
function OnMouseExit ()
{
angel1speed = 1;
}
Now, i remembered from a tutorial video i watched a week or so ago that public var makes the variable, well, public. I thought it made it so it could be used and changed in multiple scripts. I tried declaring it again in the above script, but it still didnt want to work - so where have i gone wrong? Why doesnt this public variable change in the other script when its meant to in this one?
Thanks in advance - ><>FreakFish<><