我真的需要Unity 2D的帮助。目标是让玩家在向右行驶时向后翻转。互联网上有很多选择如何通过Sprite渲染来执行此操作。但是问题在于我的角色由部分组成,因为动画是骨头。每个部分都可以翻转。当您打开对象本身的精灵渲染中的翻转时,什么都没有。问题是如何立即发动政变?如果没有,该如何进行部分?
I really need help with Unity 2D. The goal is for the player to flip when going left and back when going right. There are many options on the Internet how to do this through sprite rendering. But the problem is that my character consists of parts, since the animation is bone. Each part can be flipped. And when you turn on flip in the sprite rendering of the object itself, nothing works. The question is how to make a coup at once the entire character? And if not, how to do it in parts?
发布评论
评论(3)
您应该通过刻度进行翻转,它将影响所有组件。它在 noreferrer“ noreferrer”> docs。
You should flip via scale, it will effect the all components.It's also metioned in the docs.
我确定您在教程中熟悉
input.getAxisRaw(“ Horizontal”)
。以最简单的方式返回字符:在此脚本中,如果轴不是0(没有按键或停止按下),请设置精灵的
scalex
等于xaxis方向。I'm sure you are familiar with
Input.GetAxisRaw ("Horizontal")
in the tutorial. Return the character in the simplest way:In This script, if Axis is not 0 (no pressed key or stop pressing), sets the
ScaleX
of the sprite equal to the xAxis direction.正如Oistikbal所说,使用这样的比例:
按下A/D时,更改了刻度,以使角色翻转。
As oistikbal said, use scaling like this:
When A/D is pressed the scale is changed so the character is flipped.