reze-engine 0.69.7 → 0.69.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/model.ts CHANGED
@@ -3183,7 +3183,8 @@ export class Model {
3183
3183
  for (const b of boneIndices) if (b >= 0 && b < n) this.physicsDriven[b] = 1
3184
3184
 
3185
3185
  // Bones to recompute after a step: anything that INHERITS from a simulated
3186
- // bone, everything under it, and anything inheriting from those in turn.
3186
+ // bone or hangs under one, everything under those, and anything inheriting
3187
+ // from them in turn.
3187
3188
  // Simulated bones themselves are deliberately excluded — their world matrix
3188
3189
  // IS the simulation's output, and recomputing it from a local pose the
3189
3190
  // simulation never wrote would throw the step away.
@@ -3198,7 +3199,9 @@ export class Model {
3198
3199
  const ap = b.appendParentIndex
3199
3200
  const inheritsAffected =
3200
3201
  (b.appendRotate || b.appendMove) && ap !== undefined && ap >= 0 && ap < n && (this.physicsDriven[ap] || affected[ap])
3201
- const parentAffected = b.parentIndex >= 0 && affected[b.parentIndex]
3202
+ // A plain child of a simulated bone — one with no body of its own, like
3203
+ // 瞳 inside Koishi's third eye — rides on the simulated world matrix.
3204
+ const parentAffected = b.parentIndex >= 0 && (affected[b.parentIndex] || this.physicsDriven[b.parentIndex])
3202
3205
  if (inheritsAffected || parentAffected) {
3203
3206
  affected[i] = 1
3204
3207
  changed = true
@@ -3251,12 +3254,12 @@ export class Model {
3251
3254
  applyPhysicsAppend(): void {
3252
3255
  const order = this.physicsAppendOrder
3253
3256
  const sources = this.physicsAppendSources
3254
- if (!order || !sources || !this.appendRotOverride || !this.appendRotOverrideSet) return
3257
+ if (!order || !this.appendRotOverride || !this.appendRotOverrideSet) return
3255
3258
  const bones = this.skeleton.bones
3256
3259
  const worldMats = this.runtimeSkeleton.worldMatrices
3257
3260
 
3258
3261
  this.appendRotOverrideSet.fill(0)
3259
- for (let s = 0; s < sources.length; s++) {
3262
+ for (let s = 0; sources && s < sources.length; s++) {
3260
3263
  const i = sources[s]
3261
3264
  const w = worldMats[i].values
3262
3265
  const p = bones[i].parentIndex