Playmaker Forum

PlayMaker News => General Discussion => Topic started by: sebaslive on February 10, 2015, 10:40:31 AM

Title: Return;
Post by: sebaslive on February 10, 2015, 10:40:31 AM
Code: [Select]
if(vNewInput.sqrMagnitude < 0.1f)
{
return;
}

I have this return; value and I have no idea what that means, I tried looking it up and my google skills are not up to par these days. How do I get a return in playmaker?
Title: Re: Return;
Post by: Lane on February 10, 2015, 10:42:44 AM
What are you trying to do?

The above code just means "If this sqr magnitude is less than 0.1 then drop what you're doing and go back."
Title: Re: Return;
Post by: sebaslive on February 10, 2015, 10:51:42 AM
Code: [Select]
void Update ()
{
// We are going to read the input every frame
Vector3 vNewInput = new Vector3(Input.GetAxis("Horizontal_R"), Input.GetAxis("Vertical_R"), 0.0f);
// Only do work if meaningful
if(vNewInput.sqrMagnitude < 0.1f)
{
return;
}

I am trying to get a rotating turret from my joystick and I saw that if I comment out that piece of code the turret pops back to position which is what I am missing in playmaker because I got all the other actions working except this one. I don't know how to make it stop in place and not rotate back to position.