dimforge / dimforge/bevy_rapier

object ignores collision when setting scale to negative

Open
#330 1 comment 0 reactions 0 assignees View on GitHub
A-Geometry C-Bug D-Difficult P-Medium S-not-started
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.