playMaker

Author Topic: Camera help - defaulting to wrong camera  (Read 7808 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
Camera help - defaulting to wrong camera
« on: October 17, 2013, 09:08:10 AM »
Hi,

So I'm now at the stage where I'm adding additional cameras to my scene (for cutscenes and focusing on specific objects based on gameplay), but my scene is defaulting to the new cameras I have added, rather than my Main Camera.

I've looked at the properties, and I can't see why this is happening. I've even looked at changing the naming of it (incase Unity is taking the first alphabetical camera) or whether it's in the route, or in an empty gameobject as a child, and nothing helps.

Surely I don't have to resort to creating a camera for when it's needed and then destroying it, do it?

You can have multiple cameras existing within a scene, right?

This current behavious doesn't seem to make sense.

Any pointers?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Camera help - defaulting to wrong camera
« Reply #1 on: October 17, 2013, 09:16:04 AM »
Do any other cameras have the Main Camera tag? The first one to be tagged Main Camera should be the one Unity goes with.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #2 on: October 17, 2013, 09:30:52 AM »
Nope.

The main camera has the tag "MainCamera" (I think this originated from a demo playmaker scene) and the 2nd camera is untagged.

Should this be changed to "Main Camera"? 

Edit: Changing to "Main Camera" had no effect.
« Last Edit: October 17, 2013, 09:33:18 AM by jess84 »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Camera help - defaulting to wrong camera
« Reply #3 on: October 17, 2013, 09:35:30 AM »
MainCamera should be correct.

http://answers.unity3d.com/questions/63221/how-to-set-main-camera.html

Have you tried using Set Main Camera to define it manually? Its fine to have plenty of cameras, you can use Cut To Camera to switch between them. Is is happening immediately as if the new cameras are taking the MainCamera status or is it happening after switching?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #4 on: October 17, 2013, 09:42:41 AM »
Using 'Set Main Camera' action on it didn't work - the scene still begins showing Camera 2.

I've checked the FSM I've used for Cut to Camera, and that never uses 'Make Main Camera', so that's not the problem either.

I really have no idea. Camera 2 is untagged, is in the same level of hierarchy as Main Camera. Main Camera is tagged as MainCamera.

If I delete Camera 2 from the scene, then the scene begins correctly with Main Camera being used.   :-\

Edit: And then if I create a new Camera, that automatically becomes the scene's default camera :(
« Last Edit: October 17, 2013, 09:44:20 AM by jess84 »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Camera help - defaulting to wrong camera
« Reply #5 on: October 17, 2013, 10:09:05 AM »
Do you have a camera control FSM? You could just switch to the camera you're primarily using immediately at runtime to force it to use a specific one.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #6 on: October 17, 2013, 10:13:30 AM »
Nope, not working. I created a FSM when loading the room, with 'Cut To Camera' to Main Camera - but it remained on Camera 2.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Camera help - defaulting to wrong camera
« Reply #7 on: October 17, 2013, 10:20:39 AM »
I think either something is overriding it in your scripts or FSM's somewhere... Or there is some background setting for the project that is changing the default behaviour to be forcing it to act like that.

Create a new Scene within that project and see if you can control the active camera using the actions, then if it is working you know its an issue within the scene. If it is still acting up then make a new project and try controlling the cameras there so see if it is a problem at the Project level. If its STILL acting up, then.. well.. It must be an issue with the Unity install or something, I assume.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #8 on: November 06, 2013, 07:10:53 PM »
More weirdness;

So I've set up 8 cameras along my path, and have 8 trigger boxes to allow me to do 'Cut to Camera' states. The first two work perfectly, the third one however shows camera 8 and not camera 3. This is infuriating as I can clearly see the trigger area being hit, and I can see that I've linked the correct camera. There really is no reason for this.

So I then delete camera 8, and retest, and it cuts to camera 7 instead of camera 3.

I don't have any other cameras in the scene, and the start camera is the only one marked as MainCamera (although I've also tried untagging it. Cameras 2-8 are just duplicates of camera 1 with their names and positions changed (and tags set).  There is no difference between camera 2 and camera 3, yet it just won't work.

None of my trigger areas are overlapping, and I've looked at the 'Cut to Camera' state 100 times to make sure i'm not being an idiot.

Urgh.

Anyone had similar, or have any ideas?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #9 on: November 06, 2013, 07:33:48 PM »
Ok, I've created a new scene, copying the cameras and triggers, and it works.

Any suggestions on how to track down the culprit in my real scene? Any ideas what type of thing might cause this? I've been through everything a few times and haven't found a suspect yet.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Camera help - defaulting to wrong camera
« Reply #10 on: November 06, 2013, 07:57:03 PM »
I duplicated the issue in a blank scene but can't tell if its a Unity problem with multi-cam stuff, an action problem, or if we're missing a draw issue by having many cameras demand to be drawn.

I tried putting them all on the same depth, didn't help. Weird thing is how inconsistent it is when choosing a camera. I have no idea why its picking the ones it does. Sometimes the changes are totally unresponsive.

Here's the hack-around...

I ended up deactivating all of the cameras that aren't being used and that fixed it, but at that point you don't even need Cut To Camera since Unity will already choose the next available camera that is activated... That could be a problem in more complex scenes or an advanced FPS controller that uses a gun camera, make sure the Depth is set correctly so this isn't an issue.

/edit

I reported it as a bug, maybe Alex can confirm if it's an issue with the action or not, but it seems more like its Unity being weird.
« Last Edit: November 06, 2013, 08:09:48 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #11 on: November 06, 2013, 08:30:08 PM »
Phew.... that's for investigating... I was beginning to think I was going mad!

It's a strange one, surely there's no reason for it to randomly decide to show a random camera instead of the intended one!  ???

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Camera help - defaulting to wrong camera
« Reply #12 on: November 06, 2013, 08:37:57 PM »
Yeah I don't get it either. Very strange... It may not be random, but be doing something internal that isn't playing well with Cut To Camera. I wonder what the standard Unity procedure is for doing a Cut To Camera equivalent.

I ended up just repositioning the Main Camera transform in the Oomph kit, but that was for maintaining potential post effects consistency, mostly, so this issue was under my radar.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Camera help - defaulting to wrong camera
« Reply #13 on: November 07, 2013, 11:01:50 AM »
Cheers again for the help with this. All 8 cameras now working and transitioning as intended!

(I am however rueing the 4 hours of frustration of getting to this point, when my original idea should have worked. Damn you Unity!!)

odd29

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Camera help - defaulting to wrong camera
« Reply #14 on: April 17, 2015, 04:57:40 AM »
Same Problem for me :-(.

Ive created an old school resident evil scene with the newest unity and newest playmaker Version.
ive created 7 Cameras and 7 Triggers like in a youtube tutorial.
The first two triggers acting correct but when my player model reaches trigger 3 a wrong camera is activating. Then im moving my character back to trigger 2 and again to trigger 3 and then the camera is correct.
dont know whats wrong and why the trigger is activating the right camera only after activating the trigger the second time :-(