playMaker

Author Topic: Move camera B to position and rotation of camera A(With bonus question!)[solved]  (Read 3479 times)

createasaurus

  • Full Member
  • ***
  • Posts: 146
I need to take control away from my FPS player camera, then have the camera look somewhere specific.

To do this I plan to have 2 cameras: Player Camera A and Script Controlled Camera B.

I understand how to enable and disable the cameras to toggle between.  However, I'd like there to be no perceived transition.  So, I'd like to move Camera B's start position to the location / rotation of Camera A.  I assume there is a Get and Set Position and Rotation action, and I will store these as a variable type, perhaps Vector 3?  However, I cannot seem to find the right actions to do this.  Any help would be appreciated.

Bonus question:  My FPS camera is actually a UFPS camera,  therefore its true position and rotation are the combination of the player (position and rotation) + the camera (position and rotation.)  Does this make sense?  The player has a position, but the camera child also has its own position to account for the bounciness of the camera.  Considering this, how will I get the true camera position?

Thank you very much!
Chris (createasaurus)
« Last Edit: December 15, 2014, 09:08:04 PM by createasaurus »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Move camera B to position and rotation of camera A. (With bonus question!)
« Reply #1 on: December 15, 2014, 02:24:52 PM »
You should be able to target the FPS camera directly with Get Position and Get Rotation, store their Vector3's, then use Set Position and Set Rotation on the Cinema camera, injecting those stored Vector3's

If you switch the camera in the same frame after the position matching then there shouldn't be any noticeable transition. Haven't tried this myself, but it should work fine.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Move camera B to position and rotation of camera A. (With bonus question!)
« Reply #2 on: December 15, 2014, 02:51:33 PM »
Hi Lane,
Thank you!  The good news is it is mostly working.
The interesting thing is there is a small screen jump half the time.
I am wondering why this is happening and if it is possible to eliminate this?
I'm going to keep playing around.
Thanks!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Move camera B to position and rotation of camera A. (With bonus question!)
« Reply #3 on: December 15, 2014, 02:59:45 PM »
Hmm.. This is probably going to be hard to nail down, but I think its just a matter of when you're switching the camera. Its kind of tricky to do this with absolutely zero jitter. Maybe try moving around the camera switch to before/after the position match, thats the only real factor I can think of here.

Or you could try making the Cinema camera a child of the FPS camera, then you may not even need the position match, just switch cameras and unparent it when you want. Reparent and zero out the transform data when you want to return.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

createasaurus

  • Full Member
  • ***
  • Posts: 146
Quote
try moving around the camera switch
Quote
Try making the Cinema camera a child of the FPS camera...unparent/reparent
Thank you, Lane.  These are great ideas.  I've been fiddling with both these, but it will not get 100% perfect... and that is OK.  I think my game will be fine with a little jitter.
I'm just glad to know I didn't quit before giving it a good try.  I suspect all those bouncy springs on the UFPS camera with may be contributing... but it is just a theory.
Thanks again,
Chris (createasaurus)

###Update, it actually is working pretty good now.  I do not really notice a hiccup anymore.  One weird thing I fixed was scaling to 1,1,1 on unparent.  For some reason the scale was shifting down to something like 1,1,.999999998. on unparent.   Weird?!  The unparented camera was a child of the UFPS camera, so maybe there is some voodoo UFPS code thing happening there.
« Last Edit: December 16, 2014, 06:29:31 PM by createasaurus »