Hello guys,
I have a question about what is going on here. When flipping the character i get this bug in some of the colliders, not all of them:
Loading Image
You can see the head collider is really small. Someone knows why? This is how i am flipping:
public class FightersInteractivity : MonoBehaviour {
// ID DO CHARACTER
public int playerNumber;
Transform enemy;
Animator anim;
void Start() {
anim = GetComponentInParent<Animator>();
GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
foreach (GameObject p1 in players)
{
if (p1.transform != this.transform)
{
enemy = p1.transform;
}
}
}
void Update () {
ScaleCheck();
}
void ScaleCheck()
{
if (transform.position.x > enemy.position.x)
transform.localScale = new Vector3(-1, 1, 1);
else
transform.localScale = Vector3.one;
}
When using "flip X" in skeleton utility the same thing happens.
When writting directly in the inspector
Rotation = 0 / 180 / 0
It does not.
10 Dec 2015, 15:52
Ok, so i fixed using what now i belive is the right way to rotate things kkkk
Juste changed the ScaleCheck(); to this:
void ScaleCheck()
{
if (transform.position.x > enemy.position.x)
transform.localRotation = Quaternion.Euler(0.0f, 180.0f, 0.0f);
else
transform.localRotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);
}
But still curious to learn why the other way was a wrong one, if someone knows it would be great!
Thanks