1 Reply Latest reply on Nov 23, 2006 7:43 PM by James Newton, ACP

    3D Fountain trail to avoid the Cursor

    christian_cruz
      Hello!

      I just started doing somethings with 3D,I would like to know how can make the trail of the fountain that can be generated with the code I'm going to show can avoid the cursor.

      on beginSprite me
      sprite(me.spriteNum).member.resetWorld()

      -- create particle system
      myPartRes = sprite(me.spriteNum).member.newModelResource("My Particle Resource",#particle)

      -- range of speeds
      myPartRes.emitter.minSpeed = 20
      myPartRes.emitter.maxSpeed = 80

      -- just enough particles to make it look like smoke
      myPartRes.emitter.numParticles = 5000

      -- narrow stream, straight up
      myPartRes.emitter.angle = 15
      myPartRes.emitter.direction = vector(0,1,0)

      -- live about long enough to get off the screen
      myPartRes.lifetime = 10000

      -- start full blend, then fade
      myPartRes.blendRange.start = 100
      myPartRes.blendRange.end = 0

      -- wind to blow the smoke away
      myPartRes.wind = vector(15,0,0)
      myPartRes.drag = 5

      -- place particle system
      myPartSys = sprite(me.spriteNum).member.newModel("My Particle System",myPartRes)
      end

      I guess it has something to do with the _mouse.mouseLoc and the vector on the --wind to blow the smoke away -- line, but I cannot figure it out, mouseLoc return a 2 point coordinate position, and the vector uses 3.

      Maybe my quetion is naive or basic, but I just need a hint or some advice to start doing things by myself.

      thanks in advance.