Thanks for the reply, Jean.
Well i haven't made a separate testing scene, i'm just using one of my level scenes where i want to use the action for real. But since i can't get the action to compile i haven't even gotten to testing.
Well, like i said my biggest problem is i don't understand where i should put everything, since in the original script the
Vector3 heading = target.position - transform.position;
dirNum = AngleDir(transform.forward, heading, transform.up);
is in Update, then Update seems to be closed off and the rest just seems to float there without being part of any function. If i try to ape this, by putting the same bit into my doSideTest function and leave the rest of the code outside of any function like in the action attempt i posted i get an error : Assets/PlayMaker/Actions/sideTest.cs(57,50): error CS1061: Type `UnityEngine.GameObject' does not contain a definition for `position' and no extension method `position' of type `UnityEngine.GameObject' could be found (are you missing a using directive or an assembly reference?)
If i try to include everything in doSideTest, like here:
void DoSideTest()
{
var target = Fsm.GetOwnerDefaultTarget(gameObject);
Vector3 heading = target.position - transform.position;
dirNum = AngleDir(transform.forward, heading, transform.up);
float AngleDir(Vector3 fwd, Vector3 targetDir, Vector3 up) {
Vector3 perp = Vector3.Cross(fwd, targetDir);
float dir = Vector3.Dot(perp, up);
if (dir > 0f) {
direction.Value = 1f;
} else if (dir < 0f) {
direction.Value = -1f;
} else {
direction.Value = 0f;
}
}
}
Then i get parsing errors about missing semicolons.