From 2d2ce703d98f872dffa857ebdba823975b64f443 Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Sat, 6 Aug 2011 03:55:56 +0000 Subject: [PATCH] * Added AbstractControl.getSpatial() as otherwise AnimEventListener is kinda useless as it only gives the AnimControl as the reference and to get userdata you need the spatial itself * World space particles are now influenced by rotation git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7980 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/effect/ParticleEmitter.java | 5 ++++- engine/src/core/com/jme3/scene/control/AbstractControl.java | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/engine/src/core/com/jme3/effect/ParticleEmitter.java b/engine/src/core/com/jme3/effect/ParticleEmitter.java index 53bb463af..f96bec6da 100644 --- a/engine/src/core/com/jme3/effect/ParticleEmitter.java +++ b/engine/src/core/com/jme3/effect/ParticleEmitter.java @@ -44,6 +44,7 @@ import com.jme3.export.OutputCapsule; import com.jme3.math.ColorRGBA; import com.jme3.math.FastMath; import com.jme3.math.Matrix3f; +import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.renderer.Camera; import com.jme3.renderer.RenderManager; @@ -878,7 +879,9 @@ public class ParticleEmitter extends Geometry { //shape.getRandomPoint(p.position); particleInfluencer.influenceParticle(p, shape); if (worldSpace) { - p.position.addLocal(worldTransform.getTranslation()); + worldTransform.transformVector(p.position, p.position); + worldTransform.getRotation().mult(p.velocity, p.velocity); + // TODO: Make scale relevant somehow?? } if (randomAngle) { p.angle = FastMath.nextRandomFloat() * FastMath.TWO_PI; diff --git a/engine/src/core/com/jme3/scene/control/AbstractControl.java b/engine/src/core/com/jme3/scene/control/AbstractControl.java index 0eade13b2..2f3875e82 100644 --- a/engine/src/core/com/jme3/scene/control/AbstractControl.java +++ b/engine/src/core/com/jme3/scene/control/AbstractControl.java @@ -60,6 +60,10 @@ public abstract class AbstractControl implements Control { } this.spatial = spatial; } + + public Spatial getSpatial(){ + return spatial; + } public void setEnabled(boolean enabled) { this.enabled = enabled;