Hi, I like this project, its exactly what i've been searching for.
But it seems that ocluders ignore parent transformations.
Attaching a Rapier collider as children works jsut fine, they share the parents transformation, augmenting its own.
But the LightOccluder2D just doesnt seem to like it. To make it work, I had to get the current translation using query, and then set the SpatialBundle transform to the values of the parent.
Could that be a bug? Iam still learning my way around bevy, but it seems like the parents transformation should be applied to child as well.
Many thanks.
MK
And my simplified functions for attaching a coliders to the MapBundle entity using my calculated collider rectangle as input.
// rapier
let id = world.spawn(Collider::cuboid(rect.half_size().x, rect.half_size().y))
.insert(TransformBundle::from(Transform::from_xyz(
rect.center().x,
rect.center().y,
2.
)))
.id();
world.entity_mut(map_id).add_child(id);
let t = world.entity(map_id).get::<Transform>().unwrap().translation; // the modification I had to do
// ocluders
let id = world.spawn(LightOccluder2D {h_size: rect.half_size()})
.insert(SpatialBundle::from_transform(Transform::from_xyz( // I had to use Spatial bundle, since simple transform bundle didnt work
rect.center().x + t.x,
rect.center().y + t.y,
2. + t.z
)))
.id();
world.entity_mut(map_id).add_child(id);
Hi, I like this project, its exactly what i've been searching for. But it seems that ocluders ignore parent transformations. Attaching a Rapier collider as children works jsut fine, they share the parents transformation, augmenting its own. But the LightOccluder2D just doesnt seem to like it. To make it work, I had to get the current translation using query, and then set the SpatialBundle transform to the values of the parent.
Could that be a bug? Iam still learning my way around bevy, but it seems like the parents transformation should be applied to child as well. Many thanks. MK
The parent:
And my simplified functions for attaching a coliders to the MapBundle entity using my calculated collider rectangle as input.