Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object ignores collision when setting scale to negative #330

Open
asdgghgrwfgrefd opened this issue Feb 17, 2023 · 1 comment
Open

object ignores collision when setting scale to negative #330

asdgghgrwfgrefd opened this issue Feb 17, 2023 · 1 comment
Labels
A-Geometry C-Bug Something isn't working D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started

Comments

@asdgghgrwfgrefd
Copy link

when setting the scale to negative the object ignores collisions

this is related to #246
setting the x scale to negative is a way to flip the whole object and children easely from left to right
here is the function to add as a startupsystem:

`
fn test(
mut commands : Commands,

){

let object_width = 10.0;
let object_height = 25.0;




commands.spawn_empty(



)

    .insert(

    Collider::cuboid(object_width, object_height)
    )
    .insert(RigidBody::Dynamic)
    .insert(LockedAxes::ROTATION_LOCKED)
    .insert(Transform::from_xyz(-50.,200.,0.))
    .insert(GlobalTransform::default())

    ;




let mut other_object_transform = Transform::from_xyz(0.,200.,0.);
other_object_transform.scale.x = -1.;
commands.spawn_empty(


)



    .insert(

    Collider::cuboid(object_width, object_height)
    )
    .insert(RigidBody::Dynamic)
    .insert(LockedAxes::ROTATION_LOCKED)

    .insert(other_object_transform)
    .insert(GlobalTransform::default())

    ;


let ground_size = 500.0;
let ground_height = 30.0;



let map_ground = commands.spawn_empty()
    .insert(

    Collider::cuboid(ground_size, ground_height)
    )
    .insert(RigidBody::Fixed)
    .id();



let mut camera_transform = Transform::from_scale(Vec3::new(0.5,0.5,1.));
camera_transform.translation.z = 900.;

let camera_ent = commands.spawn(
    Camera2dBundle::default())
    .insert(camera_transform)
    .insert(PlayerCamera)
    .id()

    ;

}

`
what i expected the two objects fall and collide with the plattform

what happend the modified object falls though the plattform

@Vrixyz
Copy link
Contributor

Vrixyz commented May 24, 2024

Coming from Unity, I'm not too surprised negative scaling can cause issues, that said it would be interesting to support 👍 ; I'm not sure if it's an issue on bevy_rapier or upstream (rapier/parry).

@Vrixyz Vrixyz added C-Bug Something isn't working D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... A-Geometry P-Medium S-not-started Work has not started labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Geometry C-Bug Something isn't working D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started
Projects
None yet
Development

No branches or pull requests

2 participants