Added scene transform update on load

This commit is contained in:
2024-12-27 23:56:39 +01:00
parent 691766fa8c
commit a78c2ccb93
4 changed files with 11 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ Entity :: struct {
rendering_offset: Vector3;
snap_offset: Vector3;
snap_intervals: Vector3;
snap_intervals: Vector3 = .{1,1,1};
renderable: Renderable; @DontSerialize
animator: Animator; @DontSerialize

View File

@@ -64,6 +64,7 @@ load_scene :: (name: string) -> *Scene {
next_entity_id = cast(Entity_Id)(highest + 1);
update_transforms(scene);
calculate_aabbs(scene);
make_sure_nothing_collides(scene);
@@ -224,10 +225,10 @@ update_animators :: (dt: float) {
}
}
update_transforms :: () {
if engine.current_scene == null return;
update_transforms :: (scene: *Scene) {
if scene == null return;
for e: engine.current_scene.entities {
for e: scene.entities {
if e.parent == null {
update_entity_transform(e, Matrix4_Identity);
}