Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Is there a way to make a movement pattern using AnimationCurves?

$
0
0
I'm making a 2D space-shooter game, and I want the enemies to have specific movement patterns, ranging from simplistic like a linear left-right loop, to more complex like a parabola left-right motion (starting left upward, moving down approaching the center, then going upward and right in the end) I've tried using two AnimationCurve variables, one for each axis, but the movement always comes out wonky and weird no matter the function, using the following code: transform.position = new Vector3(posX + movementX.Evaluate((Time.time) * movementMultiplier), posY + movementY.Evaluate((Time.time) * movementMultiplier)); Is there a way of achieving this using AnimationCurve variables (preferably one) and evaluating them? If there's not, can you suggest another method? Thanks in advance.

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>