0 Replies Latest reply on Jan 21, 2008 6:11 PM by mmh67

    3d script help

    mmh67
      I have a simple model that has three objects which I can move around within the space. The script works but has two problems. Problem 1 is that I want one of the three objects to be unmovable. I can't figure out how to do this. Problem 2 is that if I click in an area that does not contain a model (while pressing a modifier key to determine how it moves) I get an object expected error. The script is posted below. Any insights are appreciated.

      Script:

      property p3DModel
      property piLocH
      property piLocV


      on mousewithin me

      on mouseDown(me)
      upperLeft = point(sprite(1).left, sprite(1).top)
      clickLocation = the mouseLoc - upperLeft
      p3DModel = sprite(1).camera.modelUnderLoc(clickLocation)

      piLocH = the mouseH
      piLocV = the mouseV
      end mouseDown


      on exitFrame(me)
      if piLocH then
      if the mouseDown then
      me.mRotate()
      else
      piLocH = VOID
      piLocV = VOID
      end if
      end if
      end exitFrame


      on mRotate(me) -------------------------------------------------------

      tDeltaH = (the mouseH - piLocH) / 32.0
      tDeltaV = (the mouseV - piLocV) / 32.0

      if the shiftDown then
      p3DModel.translate(tDeltaH,0,tDeltaV,#world)
      else if the controlDown then
      p3dModel.translate(0,-tDeltaV,0,#world)
      else if keypressed(6) then
      p3DModel.rotate(0, tDeltaH,0, #self)
      end if