Skip to content

Commit 55ab7ef

Browse files
fix: position syncing (#691)
1 parent 303ecf5 commit 55ab7ef

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

crates/hyperion/src/lib.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,24 @@ impl Hyperion {
356356

357357
world
358358
.component::<Player>()
359-
.add_trait::<(flecs::With, EntitySize)>()
360-
.add_trait::<(flecs::With, Yaw)>()
361-
.add_trait::<(flecs::With, Pitch)>();
359+
.add_trait::<(flecs::With, EntitySize)>();
360+
361+
// add yaw and pitch
362+
world
363+
.observer::<flecs::OnAdd, ()>()
364+
.with::<Player>()
365+
.without::<Yaw>()
366+
.each_entity(|entity, ()| {
367+
entity.set(Yaw::default());
368+
});
369+
370+
world
371+
.observer::<flecs::OnAdd, ()>()
372+
.with::<Player>()
373+
.without::<Pitch>()
374+
.each_entity(|entity, ()| {
375+
entity.set(Pitch::default());
376+
});
362377

363378
world.set(IgnMap::default());
364379

0 commit comments

Comments
 (0)