• Runtimes
  • [Unity] "transform.eulerAngles" problem

Related Discussions
...

Soo.... I've got a huge problem... The problem has to do something with transform.eulerAngles and collision....
So my character is naturaly flipped and faced right, and when i use: "transform.eulerAngles = new Vector3(0, 180, 1.525879e-05f);"
My character flips left normally, but when i face a object with another collider (when the character faces it), the character's collider and the object's collider gets some collision problem... I carefuly watched how they collide (selected both my character and the other object in the inspector Hierarcy so it displays both colliders), and the other object blocks my character from going through it faster than it should, while the object that's on the other side, when i move to it, it acts normally becouse the character is on natural rotation (transform.eulerAngles = new Vector3(0f, 0f, 0f)😉... Words can't explain it so i made pictures that I think should explain it...

Anyone knows what's the freakin problem ?

Box2D colliders dont take kindly to being rotated about the Y axis.

My general character controller practice is to keep all the graphics as a child object and keep the collider above it in the hierarchy and prevent rotating/scaling it at all. Only flipping the graphics transform saves a lot of grief.

Mitch wrote

Box2D colliders dont take kindly to being rotated about the Y axis.

My general character controller practice is to keep all the graphics as a child object and keep the collider above it in the hierarchy and prevent rotating/scaling it at all. Only flipping the graphics transform saves a lot of grief.

So can i um, add a blank object, add it as the character's child, and add collider to the blank object ? Is the child object gonna take the main's object rotation then ?

EDIT:

Tryed adding a object with texture as the character's child, and well, it take's it's mirror flip thing :/ ... Any ideas on how would i make it work, IF THIS IS even the thing you said, maybe i didn't get you right ?

EDIT 2:

Wait, you ment making a blank object with collider, and adding my whole character as it's child ? Maybe that would work, gonna try it out

EDIT 3:

Well my script is already too big to be remaked to work good like this... It's connected to it's RigidBody which is attached to the graphics and with it's collider too, i'd need to recode a lot of other stuff also, it would be damn hard...
Any other solution that would only prevent collider from rotating ? Or i'm gonna need to do it the hard way ?

I made this for you. (almost done processing - HD still processing)
Also added it to the Spine Unity examples.

Mitch wrote

I made this for you. (almost done processing - HD still processing)
Also added it to the Spine Unity examples.

Thank you man, i'm really thankful, but still, i need my own character controller, it has all the code in it, 595 lines of code that's really important, not just ya know fooling around, it's some serious stuff in it, all the character's movement...

So i guess i'll need to remake it and make it move the object that is gonna be parrent, and that will have rigidbody and collider control on it, and make the graphics do nothing but follow, and then again i'll need to remake the part where it's mirror flipping, so it mirror flips the graphics instead, and all kinds of things in the script.... This will be very annoying, NOT HARD actually, but annoying as **** .... So i'm gonna do something else and wait for you to answer if there's any other solution to this...

WWelllllll you can't rotate Box2D stuff on the Y axis safely and you can't negative scale any collider in Unity ever sooooo.... sorry 🙁

Mitch wrote

WWelllllll you can't rotate Box2D stuff on the Y axis safely and you can't negative scale any collider in Unity ever sooooo.... sorry 🙁

It's my fault from not reacting good on this... I was like: "AAh, i'll just check for solutions online, i'll make it later, i'll do it later"
and now i end up needing to remake the whole script from the scratch, which fucked my mind up now...... God... Thank you for all the help man !

And you're awesome.

Welcome :happy: Goodluck!