Forum rules - please read before posting.

UFPS and camera changes

Hi everyone,

I'm having some trouble with camera switching with my AC/UFPS project, but it comes down to something simpler than that. I think I probably don't have everything set up properly.

If my understanding is correct, the main AC camera is supposed to be the only renderer in the scene: every other camera is just a reference for position and rotation, including the main UFPS camera. The idea being that the UFPS input controls its position and rotation, and the main AC camera does the rendering work. This makes sense when looking at camera switching, which is where I started to notice that my project wasn't working as it should. I discovered that I ended up with multiple cameras active in my scene, which was hammering my performance when it comes to culling.

So I put together a test project, but I can't for the life of me get it to behave as expected: the main AC camera always stays put, never updating its position. I'm using the AC-made UFPS prefabs, as standard as they come, and a standard AC MainCamera, with the only change being the removal of the Audio Listener component.

I would expect the AC camera to "follow along" - to update its position and rotation along with the UFPS camera, but it simply doesn't do this. Am I doing something wrong, or am I expecting the wrong behaviour?

The movement method is set to Ultimate FPS, and the player prefab is assigned. I'm not sure what other settings would be pertinent, but as mentioned, the AC and UFPS game objects are stock standard.

Comments

  • That used to be the case - and still is, when using AC's internal First Person mode.  However, changes in the way UFPS worked means that the UFPS camera now has to be the "main" one whenever you want to view through it.

    AC's mainCamera should disable itself as appropriate - when you cut the camera during a cutscene, for example, it'll re-enable itself.

    The MainCamera should attach itself to regular AC cameras when enabled - is this happening, even if you're still viewing through your UFPS camera?  It's not clear from your description what exactly is occuring.
  • edited August 2015
    Thanks, @ChrisIceBox. Okay, that clears things up. I was driving myself mad for a second.

    Apologies for the roundabout way of describing the issue. I was trying to isolate the situation for testing. To outline the exact problem that I'm having:

    1) UFPS camera does its thing; player controls it, no problem.
    2) I switch cameras, for a cutscene or closeup. The UFPS camera sits back, and now the AC MainCamera changes to the closeup camera position.
    3) Then I exit the closeup, and the MainCamera stays behind, inheriting the properties of the closeup camera. I switch back to the UFPS Camera. The MainCamera stays where it was, though (not disabled), which means that it has its own occlusion culling data, which causes performance to plummet as out-of-frame meshes for the UFPS camera are still being rendered.

    I tried to switch off the camera component of the MainCamera before running the game, but that causes all sorts of weird problems. If I manually switch it off at runtime, that seems to work fine, but I'm not sure (a) how to do that with a script, and (b), if that's even a good idea.

    I'm not sure if this is simply a bug, the MainCamera doesn't disable itself, or if I'm perhaps doing something wrong.
  • When you talk about the MainCamera disabling itself - do you mean the MainCamera gameobject, the Camera component, or the MainCamera component?

    If it is enough to prevent the culling data, disabling the Camera component should be enough - though this should be done automatically when the cutscene ends.  What is the exact state of the MainCamera (component checkboxes, etc) after the cutscene compared with before the cutscene?
  • I'm referring to the camera component, which seems to be the culprit in terms of messing with my occlusion culling.

    I ran a test now and the AC camera component, Main Camera script, and MainCamera GameObject itself all stay active/enabled the entire time: before the closeup, during, and after. The only change is the Main Camera component shows that it's using the closeup camera during the closeup.

    When you refer to a cutscene, are you using that term generically or specifically? Does the action list that controls the change need to be a cutscene object for the camera change to work correctly? I've been using "ordinary" action lists stored in an asset file.
  • Generically.  So long as it's gameplay blocking, I meant.

    I've recreated the issue and will fix it for v1.47a.  That is, so long as disabling the Camera component will do the trick.
  • Thanks Chris, that's perfect. Disabling the camera component will indeed resolve the issue :)
  • Hi @ChrisIceBox, apologies for dragging this dead horse back to life and beating it again, but I have a new, related problem.

    I'm setting up camera changes, but the transitions don't work correctly if I'm using UFPS. It seems like the transition happens between the main AC camera and the new camera (close-up cam, in this case), rather than between the UFPS camera and the new camera.

    Is there a way around this? I'd think either constantly moving & rotating the AC cam to the UFPS one (even if it's disabled), or changing the transition to happen between the UFPS and new camera. I'm not sure how much of a hassle it would be to change either.

    I did try to create a PlayMaker action to move the AC camera to the UFPS location before the camera switch, but that resulted in some other weird behaviour.
  • Leave your player prefab in the scene outside of runtime, and attach a "_Camera" script component to the same object as your UFPS camera.  You'll then be able to reference it in your ActionLists.

    Then cut to this camera instantly before switching to a close-up camera (and vice-versa).  The AC MainCamera can only transition between AC cameras - not the UFPS one - so this would "mask" the problem.
  • Oh, that's a neat workaround. It works perfectly, thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.