Is there a way to get a whole bunch of planes to mirror themselves along a single axis in game using logic bricks? I have my planes parented to the bones of my armature to make a 2D character and I want him to be facing left when I push ← and right when pushing → because it is a 2D game. Right now I have two copies of my character. One facing right and one left and I have it set up so that all the planes turn invisible when the opposite button is pushed which makes for a lot of logic bricks. Does that make sense? If they just mirrored along their net origin point on the z-axis in my case, that would be way easier. I will post a pic of my current situation when I get home if you need it.
1 Answer
You can scale the object with negative value along a single axis to get a mirror.
To do so, play an action with scale keyframes:
- frame 1: scale = (1,1,1)
- frame 2: scale = (-1,1,1) [depends on your mirror axis]
Hint: As this is no turning, you still will see the front side when flipping. This means you can keep Backface Culling enabled.
-
$\begingroup$ Brilliant. How do you do scale keyframes? Do you just push s, or is there a box where you add in the values? Will this work while the armature is in the middle of another action? $\endgroup$– SilasApr 20, 2018 at 5:38
-
$\begingroup$ Press <s> enter -1 and a key indicating the axis to scale along e.g. <x>. Do not forget to create a keyframe with <i>. $\endgroup$– MonsterApr 20, 2018 at 11:09
-
$\begingroup$ Say you are pushing right to go right then you stop then you go right again without turning left. How do you keep the turning-around action from playing then? I only need it when I change directions, but not every time I push the button. Other than that, I'm excited that this method works so much better. :D $\endgroup$– SilasApr 21, 2018 at 4:35
-
$\begingroup$ You detect (or remember) what direction the object is currently facing. Then you can decide if you need to turn or not. $\endgroup$– MonsterApr 23, 2018 at 5:40