Hi,
It's sometimes useful to convert a Vector2 into a Vector3, so I made an action for this. It's especially usefull for converting screen position into vector3 for further computation.
// (c) copyright Hutong Games, LLC 2010-2012. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Vector2)]
[Tooltip("Store a Vector2 XY components into a Vector3 XY component. The Vector3 z component is also accessible for convenience")]
public class Vector2toVector3 : FsmStateAction
{
[UIHint(UIHint.Variable)]
[Tooltip("the vector2")]
public FsmVector2 vector2;
[UIHint(UIHint.Variable)]
[Tooltip("the vector3")]
public FsmVector3 vector3;
[Tooltip("The vector3 z value")]
public FsmFloat zValue;
public bool everyFrame;
public override void Reset()
{
vector2 = null;
vector3 = null;
everyFrame = false;
}
public override void OnEnter()
{
vector3.Value = new Vector3(vector2.Value.x,vector2.Value.y,zValue.Value);
if (!everyFrame)
{
Finish();
}
}
public override void OnUpdate()
{
vector3.Value = new Vector3(vector2.Value.x,vector2.Value.y,zValue.Value);
}
}
}
bye,
Jean