Categories
3DMovement

Everything about Coordinates in Meme’er

Meme’er is based on Panda3D and uses the 3D coordinate system. To overcome the inherent difficulty of modelling for 3D as much as possible, by default, the camera is kept at coordinates of (0, -120, 0) looking at (0, 0, 0). This can be changed at any story line, with same format as for any model. This document assumes we have a 3D model with a synonym “lady”.

To load lady at any point we can type

lady @(x, y, z, h, p, r, sx, sy, sz)

This will load lady at points (x, y, x). On load, the 3d orientation for the lady will be (h, p, r). HPR here refers to Head (angular orientation around Z axis), Pitch (angular orientation on XY axis) and Roll (orientation around itself). A far better and complete clarification of HPR can be found at https://discourse.panda3d.org/t/very-confuse-about-hpr/8935.

The last 3 (sx, sy and sz) are the scaling around X, Y and Z axis. Please note scaling around X or Y does mean scaling with 0 orientation.

Camera, which in Meme’er is just another model follow the same priciples. Except 2 things:

  1. Instead of HPR, for camera, they will be used for Looking At
  2. Sx, Sy and Sz is not used and is reserved for future use.

So far so good. Lets take a example.

Required: The model position coords are (0,0,0, 0,0,0, 1,1,1). The camera needs to zoom past her from 50 points to -50 points along X axis directly 10 points above head.

So, we want the camera to move from (-50,0,10) to (50,0,10) looking at point (0,0,0). This can be achieved as:

camera @(-50,0,10, 0,0,0, 1,1,1)- @(50,0,10, 0,0,0, 1,1,1)

This tells that the camera:

  1. moves from (-50,0,10) to (50,0,10)
  2. LookAt (0,0,0) all the time

Now look at somewhat complex issue. Lets say we have a pic, and as part of motion graphics, we need our car to travel a very undefined path to be set manually (something like https://youtu.be/YQ5qXx4KBtY)

For such scenarios, we have the coordinate module. Basically, the steps involved for YT video are as:

  1. Load the picture (or 3D model as applicable) with correct camera position (if not default)
  2. Using replay frame, load one such frame of picture on Canvas
  3. Manually draw the coordinate path.
  4. Click on “Co-ord”, then “Save Coords” and save the coordinates with correct camera position and looking at values.
  5. This coordinate can be used with syntax like “lady @f(coordfile)” except one issue if the aspect ratio is not same, the coordinates will not match as manually entered vs movement as shown in animation. For this we “transform” the coordinates
  6. In “Co-ord”, goto “Transform Coords”, enter the Screen size as you are using (say 1280, 720). This will be used to recalculate the new coordinates and new coordinate file will be saved as (using example above) “T_coordfile
  7. Now, we can inform that the model should follow the coordinate path of T_coordfile.

By Ruchika Gupta

https://www.facebook.com/ruchika.gupta.94402343
Twitter: @TBotjob
https://github.com/man-of-panda3d/memeer