Skip to content

Commit 7da6121

Browse files
codeyousefCodex
andauthored
Linearappfringe512/fel 128 object3d force matrix updates should honor direct (#10)
* Release 0.4.0.1 * Fix FEL-128 forced matrix world updates --------- Co-authored-by: Codex <codex@example.com>
1 parent 3abe293 commit 7da6121

4 files changed

Lines changed: 52 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to the Materia library will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.0.2] - 2026-05-05
9+
10+
### Fixed
11+
12+
- **Forced scene matrix updates**: `Object3D.updateMatrixWorld(force = true)` now recomposes the local matrix before propagating world matrices, so direct `position` and `scale` vector mutations are reflected immediately.
13+
14+
### Tests
15+
16+
- Added scene graph regression coverage for forced world-matrix updates after direct position and scale changes.
17+
818
## [0.4.0.1] - 2026-05-05
919

1020
### Fixed

src/commonMain/kotlin/io/materia/core/scene/Object3D.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ abstract class Object3D {
268268
return
269269
}
270270

271-
if (matrixAutoUpdate && matrixNeedsUpdate) {
271+
if (matrixAutoUpdate && (matrixNeedsUpdate || force)) {
272272
updateMatrix()
273273
matrixNeedsUpdate = false
274274
localMatrixVersion++
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package io.materia.core.scene
2+
3+
import kotlin.test.Test
4+
import kotlin.test.assertEquals
5+
6+
class Object3DMatrixWorldTest {
7+
@Test
8+
fun forcedMatrixWorldUpdateReflectsDirectPositionMutation() {
9+
val scene = Scene()
10+
val node = Group()
11+
scene.add(node)
12+
13+
scene.updateMatrixWorld(force = true)
14+
node.position.set(3f, 4f, 5f)
15+
16+
scene.updateMatrixWorld(force = true)
17+
18+
val worldPosition = node.matrixWorld.getPosition()
19+
assertEquals(3f, worldPosition.x)
20+
assertEquals(4f, worldPosition.y)
21+
assertEquals(5f, worldPosition.z)
22+
}
23+
24+
@Test
25+
fun forcedMatrixWorldUpdateReflectsDirectScaleMutation() {
26+
val scene = Scene()
27+
val node = Group()
28+
scene.add(node)
29+
30+
scene.updateMatrixWorld(force = true)
31+
node.scale.set(2f, 3f, 4f)
32+
33+
scene.updateMatrixWorld(force = true)
34+
35+
val worldScale = node.matrixWorld.getScale()
36+
assertEquals(2f, worldScale.x)
37+
assertEquals(3f, worldScale.y)
38+
assertEquals(4f, worldScale.z)
39+
}
40+
}

version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VERSION=0.4.0.1
1+
VERSION=0.4.0.2
22
GROUP=codes.yousef
33
ARTIFACT_ID=materia

0 commit comments

Comments
 (0)