playMaker

Author Topic: Switching Cameras usiing a spawned object  (Read 3882 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Switching Cameras usiing a spawned object
« on: October 06, 2012, 05:02:45 PM »
In my photon multiplayer fighting game, I spawn my character after the user has created the room, and/or joined.

I would like to have a kind of "Overview Cam" during the logon screen, and so have one camea that is used "In game, following your character about, and one "cool shot cam" that hovers over the level.

The only way I know that the user has joined the game, is that his character is created, so to switch from the Cool Cam to the GameCam, I tried to either:

Activate the camera game objects or (as I found a useful looking action "cut to Camera"

BUT: WHen I drag the camea on to the game object slot (in either of these solutions) I am presented with a mini menu where I can choose
Get Property
Set Property
Send Message
Cancel

Never seen this before, so I assume its because im trying to add this to a Prefab in the Project View not the scene.
I drag it into the scene temporarily (remember its gonna be spawned) and add the camera reference, it works... but when I check the prefab version, it just says  None.

How can I do this?

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Switching Cameras usiing a spawned object
« Reply #1 on: October 07, 2012, 06:06:22 AM »
why not set the depth of the camera to something like 0, 1 or 2. Your base camera has a depth of -1 so it should overlay your base camera once spawned, and switch back once destroyed.
Best,
Sven

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Switching Cameras usiing a spawned object
« Reply #2 on: October 08, 2012, 01:34:52 AM »
Hi,

It seems you are not dragging properly, this mini menu appears when you drag a gameObject or component in the state tab where actions should go. Are you sure you are dragging on the action property itself?

bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Switching Cameras usiing a spawned object
« Reply #3 on: October 08, 2012, 02:23:27 AM »
Thanks both, Jean I'm pretty sure I'm dragging correctly, maybe there's an interface bug her... should try a restart? and Kiriri, I don't know this technique ... seems useful, will check it out.
I thought I'd come to a solution by managing to have the character set a I'm Alive variable, and then linking camera activity to this variable. This was flawed cos it worked for first character, but subsequent spawns by other players were stuck on the IntroCam, cis the first spawning character had already set the variable. My plan was to try to create a variable based on the name of the character, which is unique. some thing like Playername + I'm alive. resulting in vars called player-clone1-imAlive. not sure if this is best way,tho.

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Switching Cameras usiing a spawned object
« Reply #4 on: October 08, 2012, 03:51:43 PM »
Im afraid Im still having trouble with this Jean...
Im stil getting this little,
Get Property
Set Property menu thing.

Remember that my FSM is on a PREFAB, that is NOT currently in the scene.. its spawned in by Photon.

Even though my logic for this camera switching thing may have been flawed, whatever I try, I get this menu... It WILL NOT let me drag a Game Object from the Hierarchy to the FSM, and Im sure that because  its a Prefab...

For example: Heres a new way I thought of...
BEFORE the room is started by Photon, and before the character is Spawned, There is a nice, trippy overvie camera. Then as photon spawns the player, the player has an FSM that runs when created. All I have to do is use Set Main Camera!
BUT, if I try to drag Main Camera into Game Object Slot of "Set MAin Camera"... up comes the little menu...!

Dont believe me? Heres a little film!

www.markfrancombe.com/oak/PhotonPMthing.mov

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Switching Cameras usiing a spawned object
« Reply #5 on: October 09, 2012, 02:29:22 AM »
Hi,

[EDIT]

 Thanks for the video, I know see the problem.

What is your prefab made of? I tried here and it works even telling me it requires a camera component if I drop an gameObject that doens't have one.

bye,

 Jean

« Last Edit: October 09, 2012, 02:34:36 AM by jeanfabre »

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Switching Cameras usiing a spawned object
« Reply #6 on: October 09, 2012, 03:49:13 AM »
The prefab is my character, just has the photon scripts an animation controller and an FSM that handles Death (a camera fade) and a Re-spawn. Theres the blob shadow projecore for Wow shadows, and the model and its animations!

That it!

I hope there is a real obvious error, cos Im not understanding S***!!!

 :)

Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Switching Cameras usiing a spawned object
« Reply #7 on: October 10, 2012, 01:52:38 AM »
Hi,

I am unsure myself on what exactly is not working here...

bye,

 Jean