5 Replies Latest reply on Dec 19, 2006 3:58 AM by Nickname_is_none

    Restrict Camera movement and collision

    Nickname_is_none Level 1
      I have a tunnel exported from 3ds max 8, with a camera that I have added behaviours to in Director MX 2004. I have buttons on the screen that act as the triggers to move the camera rotate left/ right/ up/ down, and move forwards and backwards.

      Is there an easy way of ensuring that the camera does not go through the tunnel walls (either in Max or Director)? I've been trying to interpret a collision modifier, but I'm not having any luck and I'm not sure if this is the right way to go.

      Also, can I restrict the camera from rotating a full 360 degrees? Maybe just 90 degrees in each direction.

      Any help would be much appreciated.
        • 1. Re: Restrict Camera movement and collision
          duckets Level 1
          Collision detection (particularly in 3d) is almost always non-trivial, and the best method is largely dependant on specifically what form your 3d scene takes.

          What is your tunnel like? a straight cylinder? a cylinder along an arbitrary path? A hemi-cylinder? Does the camera 'float' along or is it supposed to be walking along?

          How about posting a link to what you have so far?

          - Ben
          • 2. Re: Restrict Camera movement and collision
            Nickname_is_none Level 1
            It's a basic straight cylinder that I've put an image map on to make it look like a pipe, there's a little bit of debris lying around in the tunnel (just as something to look at and zoom in on). I want to pretend that the camera is a scope.

            I have an image of the remote control to the right side of the stage, you can click on the buttons of the remote to trigger the movement of the scope (camera). There is an image of a screen on the left side of the stage where you can effectively see what the scope see's.

            I want the scope to move like a worm with a head-mounted camera (getting technical now!!!!), to only move around roughly 90 degrees in each direction. but at the moment, my scope (camera) can move 360 degrees in any direction and can zoom through the pipe (which I also want to prevent).
            • 3. Re: Restrict Camera movement and collision
              Nickname_is_none Level 1
              Anyone? Pretty please? I'm not really having much joy!
              • 4. Re: Restrict Camera movement and collision
                duckets Level 1
                To be honest its still difficult to get an idea of what you want, and what you currently have. Perhaps you could upload a demo movie?

                How are you currently moving your camera?

                If you just want to move your camera in a straight line along the pipe, while allowing it to turn, you probably want to set the camera's transform position directly (rather than using 'translate', which will move the camera along its own axis), and setting the camera's transform rotation directly too.

                Eg: If your tube runs along the y axis, at x=0 and z=0, 'd' could be the distance along the tube to position the camera. You could gradually increase 'd' to move the cam along, and alter 'r' by small amounts to look from side to side. Every frame you would need to update your camera's position and rotation, after adjusting the values by a small amount.

                camRef.transform.position = vector(0,d,0)
                camRef.transform.rotation = vector(0,r,0)

                hope this helps

                - Ben
                • 5. Re: Restrict Camera movement and collision
                  Nickname_is_none Level 1
                  Thanks for your response.

                  I basically have a straight 3d tube and a camera. I want the camera to move like an endoscope, so you are looking inside the tube by swiveling the camera around (something like 240 degrees) and zoom in and out (which I have so far replicated by moving forwards and backwards). The only physical movement will be the pivoting around a point (effectively the base of the endoscope), the camera itself does not move backwards and forwards.

                  I also have 6 buttons to the right of the stage that control the movement of the camera (for left, right, up, down, zoom in and zoom out).

                  So far I have been using the behaviours from the Diretor library to move around. But I can't seem to constrain the movement of the camera (at the moment the camera can move in all directions and fly through the tube, which I dont want).

                  So ideally, I want to:

                  a) set limits on how far the camera can swivel in any direction
                  b) set limits to how far the camera can zoom in/out
                  c) ensure that the camera does not collide/pass through the tube

                  Is this ant clearer? I'm starting to confuse myself!!!!