Hi guys,
We are using Unity3D to see if could use it in 2D for a few games.
We are using models with textures on planes and animate these in Cinema 4D R10 and use the .c4d files in Unity.
We use a negative scale to flip the plane the other way, for walking left / right.
One problem we are having is that our animations are screwed up when using it in the negative scale way. The animations are just different. In the forum i read some posts about people who did this and it worked.
What could this be, is it maybe Cinema 4D?
Or the way we animated these?
To me it would be logical to have the animation also mirrored/flipped the other way?
Any help is highly appreciated.
I presume you are doing something like:
transform.localScale.x = -1
to flip your objects?
I do something similar and discovered that I have to do that each frame in order for it to not cock-up the animations. Rather frustrating but it works.
You can also just rotate the object by 180° around the y axis and you get the same result, with the difference that you don’t raise the amount of calculations that massively (because its not only annoying, its a math bomb due to the enforced recalculation each frame)
Alternatively, switch the UVs left right, thats likely the simplest thing to do
Hi Guys,
Thanks for the reply. We’ve found that no matter what version we use of Cinema 4D we have this problem.
Just for fun we exported the same model to fbx from within cheetah and everything works…
Does it work by setting the scale every frame as I mentioned or in some other way?
Perhaps I misunderstoon the complexity of the objects you are using but if they are characters then just rotating it about the y-axis is not goign to work. If you have a complex hierarchy, which I imagine you do for character animations, then you’ll need to deal with each node of the hierarchy to preserve z-order which could get a bit messy. Also, you’d have to either have no backface culling in your shader or else switch the winding order when needed. I suppose this could work but it’s a lot of work.
Again, for a complex hierarchy you can’t just reverse the UVs.
Thanks for your reply.
But we think the cinema 4d export(we tried r10 + r11) isn’t all that. The same model from within cheetah exported is just fine.
We just keep using Cheetah for now.
I’ve just realised that for a while I’ve misunderstood something about how Unity uses localScale. As already said, I’ve been setting transform.localScale.x every frame. I should have been setting transform.localScale = new Vector3(…) once. You learn something every day.
I had a similar issue where setting the scale to -1 would be overwritten as soon as the animation began. However, creating an empty parent gameobject and setting its scale to -1 in the Inspector yielded the desired results.
@getluky:
That seems logical to me as i had similar problems that i solved with creating a parent object and setting stuff on that.
Thanks.