Harald escribió
I have implemented the above function myself, I want to make SkeletonAnimation move,
I used the following code:
Vector3 acc = Vector3.zero;
Vector3 diff;
if(Input .GetKey (KeyCode .A))
{
transform.localScale = new Vector3(-1, 1, 1);
acc.x = -0.1f;
}
if(Input .GetKey (KeyCode .D))
{
transform.localScale = new Vector3(1, 1, 1);
acc.x = 0.1f;
}
diff = Vector3.MoveTowards(transform.localPosition, transform.localPosition + acc, 0.5f * Time.time);
transform.localPosition = diff;
But this did not fulfill my requirements.
I want to achieve pressing
- When I press keyboard A, SkeletonAnimation moves to the left
- When I press keyboard D, SkeletonAnimation moves to the right
Please give me an example.
Thank you