I’m making a fighting game. I’d like the character animations to be flipped when the player is on the player 2 side. Do I need to make two versions of ever animation and call the appropriate one depending on what side the character is on, or is there an easier way I can use via scripting or something ?
I did some searching and couldn’t find anything on this.
Making two versions of every single animation sounds a lot like logistical hell, not to mention a waste of memory compared to flipping them at runtime.
have you tried adding an empty as a parent of the object containing the animations?..when you change the player 1 to player 2 side, you practically rotate 180º the empty (that is serving as a world for the player 1 fighter), that does not affect the animation itself…
you can define that you want to look at player 2 anytime… so when you change the position, the empty rotates automatically…
this is what i think could work ?.. hope…
That’s what I’m doing at the moment, but a rotation and a reflection are two different kinds of transformation.
With the rotation, if the character has their front to the camera while on the player 1 side, they will have their back to the camera while on the player 2 side. I’d like it to mirror the animation so they have their front to the camera both ways.
I actually have a completely ridicules solution idea that I’d like to explain (to see if people think it’s viable):
I can apply a scale of -1 to the appropriate axis when the character is on the player 2 side, this flips the mesh and effectively the animations, unfortunately it also buggers up one of the channels of the normal map, but that can be fixed by passing a float4 of normal coefficients into the shader to re-invert the affected channel.
Another problem is that it also flips any unsymmetrical detail on the character model (like in old 2D games), I can get around this by having 2 versions of the character mesh, one a reflection of the other. I’d have one active while the other is deactivated, and switch which is the active one when they change sides.
That’s pretty ridicules though… to create the flipped version of the mesh I need to duplicate it (in blender), mirror it, and then swap all the vertex groups over from left to right (hopefully there is a quick way to do this).
Are there any performance costs associated with having 2 skinned meshes, one hidden and one active, and swapping them a lot?
looks a weird but effective solution, the performance will depend of your fighter mesh poly level… but i think if both (real and reflected player) are using the same material it will be right…
btw, would be great if you post a webplayer anytime to see how it works, i´m interested in your idea… i must to do something similar…
It’s still just an idea right now, I want to finish my character’s model before making the flipped version, so it’ll be a lil while yet before I try to implement it.
Maybe you need to scale your character along the axis X. Try setting the scale for your character on a scale X = -1. I think it will work. You need to make only one side of the animation. When the charter beyond the second fighter rescaling it x = 1, and run the end of the animation, which began before or any other animation that you need