decoamorim

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:


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
Developer/Founder at DCF Studios
http://www.studiosdcf.com/
Author of
Cruz Brothers[PS4 / STEAM] [upcoming on XboxOne] - http://www.cruzbrothersgame.com
Bunny Battle Arena[STEAM] - https://store.steampowered.com/app/872340/Bunny_Battle_Arena/
Kullanıcı avatarı
decoamorim
  • Mesajlar: 131

Pharan

Since this had nothing to do with Spine, I think you'll have better luck getting answers in the Unity Physics forums: http://forum.unity3d.com/forums/physics.78/

The short of it is, negative scale does weird things to colliders. With or without Spine.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

decoamorim

Pharan yazdı:Since this had nothing to do with Spine, I think you'll have better luck getting answers in the Unity Physics forums: http://forum.unity3d.com/forums/physics.78/

The short of it is, negative scale does weird things to colliders. With or without Spine.
Ok, ill post there.
Developer/Founder at DCF Studios
http://www.studiosdcf.com/
Author of
Cruz Brothers[PS4 / STEAM] [upcoming on XboxOne] - http://www.cruzbrothersgame.com
Bunny Battle Arena[STEAM] - https://store.steampowered.com/app/872340/Bunny_Battle_Arena/
Kullanıcı avatarı
decoamorim
  • Mesajlar: 131


Dön Unity