[英]Limit collected points to three per level (Like the Stars in Angry Birds)
[英]How can I make an object to face the direction it's moving like the birds at angry birds 2?
我正在使用Unity2D。 我想讓我的物體面對它的移動方向。 當對象向左移動時,它將面向左方向。 當物體向上移動時,它將面向上。
我希望它像憤怒的小鳥2上的小鳥一樣飛翔。
不是2D專家,但您可以做這樣的事情
private Vector3 lastFramePos;
private void Update()
{
// get the direction
var direction = (transfor.position - lastFramePos).normalized;
// set the look direction depending on your needs e.g.
transform.right = direction;
// don't forget to update the lastFramePos
lastFramePos = transform.position;
}
注意:在智能手機上鍵入內容,因此沒有保修,但我希望這個想法能弄清楚
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.