Compare commits

..
Author SHA1 Message Date
Landon Wills dac4eb3501 Experimental fix for unintentional local emitter rotation 2026-11-12 16:51:42 -05:00
5 changed files with 6 additions and 5 deletions

No files matched your search

+1
View File
@@ -29,6 +29,7 @@
- Added `v.spawnable_position` to the weight spawn rule component's "weight" expression
### Particles
- Fixes emitters being rotated by a model's locators when local rotation was off. This should fix some niche unexpected rotation issues from occurring.
### Localization
- Updated translations for:
@@ -31,8 +31,8 @@ class EmitterSpace(
}
}
fun initializeEmitterMatrix(rootMatrix: MatrixWrapper, locatorMatrix: MatrixWrapper): MatrixWrapper {
var rootRotation = rootMatrix.matrix.getRotation(AxisAngle4f())
fun initializeEmitterMatrix(rootMatrix: MatrixWrapper, locatorMatrix: MatrixWrapper, localSpaceRotation: Boolean = true): MatrixWrapper {
var rootRotation = if (localSpaceRotation) rootMatrix.matrix.getRotation(AxisAngle4f()) else AxisAngle4f()
//When the locator hasn't yet been initialized, we start getting NaNs, so default to no rotation instead
if (rootRotation.x.isNaN() || rootRotation.y.isNaN() || rootRotation.z.isNaN() || rootRotation.angle.isNaN()) {
rootRotation = AxisAngle4f()
@@ -36,7 +36,7 @@ object SpawnSnowstormEntityParticleHandler : ClientNetworkPacketHandler<SpawnSno
sourceLocators.forEach { locator ->
val locatorMatrix = sourceState.locatorStates[locator]!!
val particleMatrix = effect.emitter.space.initializeEmitterMatrix(rootMatrix, locatorMatrix)
val particleMatrix = effect.emitter.space.initializeEmitterMatrix(rootMatrix, locatorMatrix, effect.space.localRotation)
val particleRuntime = MoLangRuntime().setup().setupClient()
particleRuntime.environment.query.addFunction("entity") { sourceState.runtime.environment.query }
@@ -355,7 +355,7 @@ abstract class PosableState : Schedulable {
val rootMatrix = locatorStates["root"] ?: return@addFunction DoubleValue.ZERO // Played before it's on screen for the first time
val locatorMatrix = locatorStates[locator] ?: rootMatrix
val particleMatrix = effect.emitter.space.initializeEmitterMatrix(rootMatrix, locatorMatrix)
val particleMatrix = effect.emitter.space.initializeEmitterMatrix(rootMatrix, locatorMatrix, effect.space.localRotation)
val particleRuntime = MoLangRuntime().setup().setupClient()
particleRuntime.environment.query.addFunction("entity") { runtime.environment.query }
@@ -73,7 +73,7 @@ class BedrockParticleKeyframe(
val rootMatrix = state.locatorStates["root"]!!
val locatorMatrix = state.locatorStates[locator] ?: state.locatorStates["root"]!!
val particleMatrix = effect.emitter.space.initializeEmitterMatrix(rootMatrix, locatorMatrix)
val particleMatrix = effect.emitter.space.initializeEmitterMatrix(rootMatrix, locatorMatrix, effect.space.localRotation)
if (this in state.poseParticles) {
return