1 Reply Latest reply on Jul 25, 2006 1:44 PM by tedalde2

    earthquake effect on 3d world

    keogan Level 1
      Hey there,
      I know I am becoming a plague but I have so many questions. This learning curve is bloody steep. Anyway, just wondering if anybody out there have ever put any effects on a 3d world member. I would like some kind of shudder/ripple effect everytime I hit the base drum. Anybody got suggestions?
      A
        • 1. Re: earthquake effect on 3d world
          tedalde2 Level 2
          Put a little random decaying noise on your objects (or, better yet, your camera). At a frequent interval, like stepframe, or on a 30ms timeout:

          (pCount would be a global or property that increments every interval)

          pCount = pCount + 1 -- increment this every time interval
          vNoiseVector = randomVector() / pCount -- returns a random vector that gets smaller with time
          vNoiseVector = vNoiseVector * vSomeScalingFactor -- scale this very small vector up to a size that can be used in your scene
          -- set your object/camera position
          yourObjectReference.translate(vNoiseVector)

          You might want to get the position of the object (pInitialPosition) before doing this, and adjust against that postion every time. So, instead of translate, use:
          yourObjectReference.transform.position = pInitialPosition + vNoiseVector

          also you may want to power() pCount to get a faster decay.

          Just a thought. Didn't try it myself.