Download

How to rotate/flip imported sprite????

I am making a 2D game. Most of my sprites are by default ‘facing’ to the right. One of them is ‘facing’ to the left. So in its actor, if the sprite is the root object, I can change the transform scale x to -1. This works but becomes problematic if I want to make that sprite attached to another sprite. AKA, if I have an item, and its transform is going to be that of its parent, it’s going to be facing the wrong way unless it was imported the same way as its parent.

I tried to get around this by, instead of making SpriteComponent, the root component, making a SceneComponent the root. That way I could make the sprite transform axis -1 but overall the thing’s parent transform could still be 1. But this doesn’t work because when I try to set its transform to anything when SceneComponent is a root, it doesn’t move at all. SetTransform only seems to work when SpriteComponent is the root rather than SceneComponent.

I could get around this if I could change the actual sprite object derived from a Texture and have it flipped from the original way it looks on the texture it is derived from. Does anyone know of a way around this problem? Or do I have to have every sprite I import facing the same way? In Unity this would be a 2-second fix: make the sprite a child of some other component. But when I do that in unreal (with scenecomponent as the parent), then settransform doesn’t work on this object (why? that’s another thing I would like to know).

Does anyone know what I’m talking about? Supposed I imported an arrow sprite. The sprite was drawn so that the arrow is facing up. I need to rotate the sprite 90 degrees so that it faces to the right. But I can’t make the papersprite the non-root component, or else setTransform doesn’t work.