Forum rules - please read before posting.

Loading & Unloading scenes, Moving the Camera in first person

Hi everyone,

I'm trying to make a first-person adventure game where one of the main draws is being able to interact with computers in the game world in a similar way to how they do it in Fallout 3 and 4. I want to be able to zoom into the computer screen and play retry style games on the in-game computer. Here is a gif of where I've gotten to.

image

I've managed to use the scene load command to load in a game from another scene. It is output to a render texture and displayed on the model. However, I can't seem to get the level to unload when I want to quit out of it. Also, I can't get the camera to move into the correct position.

Any help would be greatly appreciated. 

Comments

  • I noticed a similar thing when rendering a video to a tender texture. When I unload the video the last frame remains as a texture, so I just disable the object in the scene when the video is switched off. Not sure if that'll fix your issue but it seemed similar.
  • Welcome to the community, @Disthron.

    By "scene load command", are you referring to AC's provided Scene: Add or remove Action, or Unity's provided scripting methods?  If the latter, you would similarly need to rely on scripting to remove the scene - otherwise, please let me know if/how AC is not performing as you expect.  AC and Unity version numbers, with as much detail as you can, would be great.

    As for changing the camera, know that AC will snap to the First Person camera during gameplay when your Settings Manager's Movement method is set to First Person.

    The way to get around this is to temporarily change your game's Movement method to None, before switching camera.  This can be done with the Engine: Manage systems Action.

    Just be aware that this actually changes the Settings Manager asset file itself, so if you exit play mode at that point, it'll still be set to "None".  To make sure your game always starts in the correct mode, define an ActionList on start game (also in your Settings Manager) that sets it's initial value to "First Person".
  • @ChrisIceBox Thanks, I'm really enjoying developing with AC so far. here's the image I tried to post above.

    image

    Scene: Add or Remove
    I am using the Scene: Add or Remove action build into AC. Here is how I expected it to work. I use the 'Scene: Add or Remove' node to add the scene when the player loads a game. This works exactly how I expect. However, when I run 'Scene: Add or Remove' to remove the scene, it isn't removed. It seems to have no effect at all.

    I'm using the 'Choose scene by: Name', I'm was using AC v1.64.5 but just upgraded to 1.65.0 and I'm still having the same issue. I can add the game to the scene but I can't remove it. The version of Unity I'm using is always the most up to date one.  I've updated it a few times during the project. The one I'm currently working on is 2018.2.11f1. Is there any other info you need?

    Camera Move
    While trying to solve the issue I found a post about moving the camera in I first person. I tried setting the player movement type to none but that didn't seem to do anything. The game seems to skip over the 'Camera: Switch' node. I made another gif to show what I'm talking about. When I look at the event nodes on the left the game seems to skip over the camera switch node.

    image 

  • edited October 2018
    Scene: Add or remove
    Is the scene you're adding an "AC" one, ie one with a GameEngine present?  Do any relevent messages appear in the Console at this time?

    This feature only works with "AC" scenes, but simply dropping the GameEngine prefab / organising the scene objects in the Scene Manager is enough to classify it as such.

    Camera Move
    The behaviour is as expected given the sequence of Actions - you're switching movement mode, waiting a second, switching camera - but then switching back to First Person before the camera transition has had time to complete.

    The second Engine: Manage systems Action can be delayed until after the transition by checking Wait until finish? in the Camera: Switch Action.  However, I suspect that you don't wish to switch back to first-person mode until after your minigame is complete - in which case you should hold off on calling this Action a second time until you're ready to return to regular gameplay.
  • Hi, Thanks for being so quick to respond.

    Scene: Add or Remove
    So the scene I was using for the dungeon crawler was not an Adventure Creator scene. After converting it to one it now loads and unloads just fine!

    Camera Switch
    I still can't get this to do anything. In the ActonList Editor the 'Camera: Switch' component now highlights for the 5 seconds that the transition time is set to but does not move. Right now all I'm doing is setting the movement method to none and then continuing to the switch camera action.
    I was getting an error message about the NavMesh, so I thought maybe I needed a navmesh for the thing to move. So I set the Pathfinding method to Unity Navigation and backed a NavMesh into the scene. It didn't' have any effect.

    Could it have something to do with the kind of camera I'm using? I think I created a normal 'Game Camera' from the camera menu in AC. It has a 'game camera' script with everything locked on it. All the view and axis movements I mean.
  • Can you post a fresh screenshot showing the ActionList in question (properties included)?

    If the Action is waiting to finish, or if you're not in First Person movement, then the camera should move just fine.  The type of Camera you're using shouldn't be a problem, and a NavMesh should not be necessary for it to work.

    Are you using a non-standard First Person camera system, or the "First Person Camera" component that AC provides?  If you select the MainCamera object in the Hierarchy at the moment the new Camera is supposed to be active, does it list this Camera as the "Attached camera" at the bottom of its Inspector?
  • I believe I'm using the camera that came with AC. I followed along with the first person tutorial after I finished making my first environment for the game. Everything when just fine in that tutorial and I've been using that first person controller since.

    I placed the pre-fab fist person player controler in the scene because I wanted to have a different post processing effect on the camera within the cabin. But otherwise, I'm pretty sure it's the same one I'm using everywhere else. Here are the stats laid out for the camera... More text below. Hope this helps.

    image

    And here is the Hotspot and the Action list that I have.

    image

    And here is the readout from the console, if that helps.

    image
  • Those "Controller" errors don't appear to be coming from AC - are you using another asset that may be conflicting?

    Please see my previous comments regarding the MainCamera - what is happing to that at the time of the issue?  Neither of the cameras in your screenshot should be rendering at runtime unless you're using some custom means.  The PostProcessing should all be done on the MainCamera, and the GameCamera/FirstPersonCamera camera components should not be active at runtime.

    While we try to find the cause of the issue, please also check Wait until finish? in the Camera: Switch Action.
  • Oh, those are from the animations on the little knight guy in the game that plays on the screen. I forgot to change one of the directions when I mad a change to how the animations on that work. I've since fixed it.

    Ok, I have gone into the player pre-fab and set the camera to inactive. I've set the PlayC64 camera to inactive and have deleated the first person player that I had in the scene... and it works!!

    "However, I suspect that you don't wish to switch back to first-person mode until after your minigame is complete"

    So, Idealy, I'd like to have a system set up where the player can look around, interact with things on the courk board, interact with the tape deck ect. If there isn't an easy solution for this I'll settle for just zooming in on the screan. This is for a uni assesment and I only have a few more weeks until it is due.

    Anyway, thanks a lot for helping me out. Here is the current result.


  • For that, you'd be best off incorporating a custom camera specifically when in the seat, that allows for restricted free-aiming.

    In first-person, spin rotation is performed by rotating the player's root - so once you leave first person mode, you'd need a custom camera to turn left and right anyway.

    Incorporating a custom camera type is generally just a matter of attaching AC's "Basic camera" component to your own camera script to make it "visible" to the ActionList system.  See the Manual's "Custom cameras" chapter for more.
  • Hi, on the game camera that I used for the zoom in position I clicked the "follow mouse" option and that seemed to work really well! It allowed me to look around the desk and interact with the tape drive.

    I also created a second hotspot over the screen so I could zoom into that, though when it dose the camera snaps into a specific position before going into the move. I did some experimentation and it seems that the system doesn't like moving from cameras that follow the mouse to ones that don't. As when I made all the cameras stationary, the transition was nice and smooth.

    I'm using the 'Game Camera' for all of them.
  • I'll attempt a recreation.  What prefab type is the second "Hotspot" camera?
  • For all the cameras I used the 'game camera' that is created through the 'Scene Manager'. At one point I tested the screen focus camera with a 'Simple Camera' created by the scene manager and it didn't appear to have any effect.

    What I'm doing is, when the player clicks the 'Sit Down' hotspot, it sets the movement to none, then moves the camera to the desk. It moves nice and smooth from the first person camera to the 'Game Camera' with follow the mouse enabled.

    The player can then interact with the Data Deck or the C64 Monitor. If they use the screen, it seems to snap to the desks mouse look camera and then move to the other game camera.

    I think that covers everything.
  • Thank you, I believe I've managed to reproduce this.
  • I can only recreate the issue insofar as it occuring after the actual transition - not before.

    What may work, as a temporary fix for you, is to allow cursor influence on the 2nd camera, but with intensity values of 0,0 so that it has no effect.
  • Hi,

    Sorry I didn't get back to you earlier. The last couple of weeks of Uni are hectic. Anyway, your fix worked really well. The player can now look around the desk and when they click on the screen it will smoothly transition into the zoom in camera. The movement is a little wonky, but it's smooth.

    Thanks a lot!
  • The latest update addresses the issue.
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.