Skip to content

Setting a Negative Scale for a Sprite Makes it Invisible #1385

Closed
@zicklag

Description

@zicklag

Bevy version

4796ea8

Operating system & version

Pop!_OS ( Ubuntu ) 20.04

What you did

Spawn a sprite in a Bevy game with an X scale of -1.0:

use bevy::prelude::*;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup.system())
        .run();
}

fn setup(
    commands: &mut Commands,
    asset_server: Res<AssetServer>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    let texture_handle = asset_server.load("branding/icon.png");
    commands
        // .spawn(OrthographicCameraBundle::new_2d())
        .spawn(OrthographicCameraBundle::new_2d())
        .spawn(SpriteBundle {
            material: materials.add(texture_handle.into()),
            transform: Transform::from_scale(Vec3::new(-1.0, 1.0, 1.0)),
            ..Default::default()
        });
}

What you expected to happen

The sprite should be displayed flipped along the X axis. At least that is the behavior I observed recently. The most recent commit I know of exhibiting the flipped behavior is bff44f7. Maybe it is not intended behavior to flip sprites by setting a negative scale?

What actually happened

The sprite was completely invisible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions