Skip to content

Instantly share code, notes, and snippets.

@cmuratori
Created April 25, 2020 06:39
Show Gist options
  • Save cmuratori/f0d20c2cc23f8eb46a337cd351338c4b to your computer and use it in GitHub Desktop.
Save cmuratori/f0d20c2cc23f8eb46a337cd351338c4b to your computer and use it in GitHub Desktop.
If I'm understanding correctly:
If you are talking about position, then the apparent relative position of the mesh (m) relative to the camera (c) is just (m - c). This means that, relative to the mesh, the camera _already has_ the position track you wanted the mesh to get, only it's negated.
So one answer is, assuming the mesh is at the origin, just copy the translation track from the camera to the mesh, and negate all three translation channels (X/Y/Z). Move the camera back to the origin, and zero out its animation. That should "just work".
If you are tool can't do that, depending on how you need to construct this, and what your art tool supports, you could go through some relatively convoluted nonsense, for example:
1) Create a dummy object at the location of the mesh.
2) Parent the camera to the dummy, but make sure to leave it's relative transform (don't zero it).
3) Add a scale -1,-1,-1 to the dummy object, thus negating the X,Y,Z of the camera position relative to the mesh.
4) Create a new camera precisely where the mesh (and dummy) are.
5) Parent the mesh to the old camera, and zero its relative transform so it is perfectly matched to the (now negated) motion of the old camera. Set it not to inherent scale so it doesn't invert itself.
6) Play back the animation. The mesh should now move relative to the NEW camera in exactly the same way that it appeared to move when viewed from the original location of the old camera.
- Casey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment