Jitter GL Camera help

    Mar 25 2013 | 4:46 pm
    Hello everyone!
    I am attempting to create a world in Jitter in which the camera is controlled by the keyboard like a video game. I was wondering if it is possible to constrain the camera view to a bounding box (much like a video game) rather than traveling through walls or separate models.
    Thanks in advance!!!

    • Mar 25 2013 | 11:17 pm
      Is there any way to get a first person view - or get the camera to react as a rigid body within the physics engine?
    • Mar 26 2013 | 2:54 am
      HI. That's a fairly advanced question. I can't help, and experience has been you may have to wait a while for a response when you're pushing the frontier a little, but don't be discouraged. And it may be some others are active on that, but it may not be very many people.
    • Mar 26 2013 | 8:38 am
      [jit.anim.camera] might provide some usefuls things for you, after that you'll probably need some jit.phys magic somewhere... atually i'm trying to do teh same thign, it's not easy...
    • Mar 26 2013 | 11:22 am
      to provide collision , think to attach a jit.phys.body/ghost to your camera to interact with other body
    • Mar 27 2013 | 9:38 pm
      Jit.anim.drive has a @ui_listen mode that allows you to do keyboard/mouse driven navigation. Double-clicking the jit.anim.drive lets you edit the controls dictionary. Hook jit.anim.drive @ui_listen 1 to your jit.gl.camera and you have FPS camera.
    • Mar 28 2013 | 1:02 am
      one way to do this is to use two jit.anim.nodes. the first anim.node is controlled by a anim.drive (which receives key and mouse input), and is bound to your gl.camera. the second anim.node is parented to the first, and controls a kinematic rigid body (jit.phys.body @kinematic 1).
      this will sync the camera with a rigid body, and cause other rigid bodies to "bounce" off the camera, as well as allow you to retrieve and process collision information from the phys.body.
      if you don't want objects to "bounce" off the camera, you can instead use a phys.ghost.
    • Mar 28 2013 | 8:20 am
      to resume the last patch you posted robert, assume that the spheres represent static walls,
      how can we ensure that the camera is constrained in its movement, it does not go through walls?
    • Mar 28 2013 | 10:19 am
      @Andrew : actually, it is not a fps camera, because the rotation is calculated on a mouse speed basis, as oppposed to a real fps where it is calculated on distance of current mouse location relatively to a fixed center location. So you can continually turn without haivng to constantly move the mouse, and you don't have that effect where you spin 81225° all of a sudden because you gave a little hiccup to your mouse :p
    • Mar 28 2013 | 3:21 pm
      @touk: you have to handle the logic yourself, based on the collision dictionary. the anim_reset message to anim.drive will cancel all currently executing animations.
      another technique is to translate the output of anim.drive into forces for a dynamic phys.body, and link the gl.camera to the phys.body (instead of the other way around).
      lots of options, but no ready-made solution (this is max after all).
      @vichug: check out the following example patch (hit the escape key to enable mouse interaction) Max 6.1/examples/jitter-examples/render/anim/anim.camera.advanced.maxpat
    • Mar 28 2013 | 3:52 pm
      @Rob : thanks ! will need a little time to understand this, but that's indeed what i'm looking for.
    • Mar 28 2013 | 6:23 pm
      yeah, it's quite a doozy. feel free to ask for any clarifications, and i'll do my best.
    • Mar 28 2013 | 8:39 pm
      Thank you all for the wonderful help! I'll ket you know how it goes!!!
    • Mar 28 2013 | 9:56 pm
      here's a slight variation of the previous patch that employs a different technique, and will keep a camera inside of the phys.world worldbox. instead of controlling a kinematic body with an anim.drive, we instead control the @position2 attribute (world-space position) of a constraint, that in turn constrains the position of a dynamic rigid-body. we then sync the position of our camera to this rigid-body.
      this technique requires some extra setup, but works quite well. obviously there's still lots of variation that can happen here, to tweak the movement.
    • Mar 30 2013 | 1:12 am
      Here is my patch thus far - not sure why I can't get the camera to move! any help would be appreciated!
    • Mar 31 2013 | 2:04 am
      [EDIT] ^ Patch is working fine now just needed to do some setup - Thanks again!
    • Jun 07 2015 | 5:45 pm
      Hi all -
      I've been trying to follow the ideas here to create a modified patch where the object-tied-to-the-camera can be collided into and respond, throwing the camera amuck. Having a little trouble figuring out where to intervene. Any pointers would be appreciated.
    • Jun 08 2015 | 1:19 pm
      Hi Harryk, post a patch if you need some help.