2 Replies Latest reply on Jan 18, 2007 6:36 AM by Nickname_is_none

    Camera collision in 3d tube

      I'm moving a camera through a 3d pipe (made in 3DS). I've got the movement sorted but I'm having trouble with the collision side of things. I want to stop my camera from passing through the tube walls.

      I've tried a modifier:


      but I get a "Variable used before assigned a value" error on my script. I think I've have put the script in the wrong place and I also need a bit of help on what else to add (maybe use the 'registerForEvent'?).

      Can anyone help?
        • 1. Re: Camera collision in 3d tube
          Level 7

          > member(Tube).model(camera01).collision.#collideAny

          Using the statement that way is telling Director that tube and camera01
          are variables. If you actually want to address a member named "Tube",
          you need to put it in quotes. (same with the model name). Check out the
          entry in the help entitled "collisionData". I think that will show you
          how to set things up.
          • 2. Re: Camera collision in 3d tube
            Nickname_is_none Level 1
            Ok thanks.

            I've looked at the collisionData section of the help file and I'm now using:

            on collideAny me, collisionData

            member("Tube").registerForEvent(#collideAny, #putDetails, 0)

            on putDetails me, collisionData
            put collisionData.modelA
            put collisionData.modelB
            put collisionData.pointOfContact
            put collisionData.collisionNormal

            I've put this in as well but I'm not sure what it does:

            -- model ("Camera01")
            -- model ("Tube01")
            -- vector ( 24.800, 0.000, 0.000 )
            -- vector ( -1.000, 0.000, 0.000 )

            This hasn't fixed the collision, I presume that now I have the collision data, I need to resolve it, so I've dug a little deeper and tried to implement (into the same behaviour):

            member("Tube").model("Camera01").collision.resolve = TRUE

            But thig isn't working either, is this the right way to go?