• edited December 2016
    @Squeaker, I placed the main camera back in again and removed my camera from the prefab. I then dragged main camera into the inspector of the JS RPG camera script and saved the prefab. So, now one of two things happens. When I place the main camera prefab/object with camera component attached I get the same a Deschanna described, and what I had earlier, the main camera with nice post effects is used but not following the player. (interesting side not that the camera now pans continuously giving a dizzying effect in my start menu/title screen, so wiered.

    So now there is NO other camera in the first playable scene of my game at all, just main camera. I play and get a static main camera where my player can run around but no camera control engaged. Ok, so not every camera control is not engaged, just the movement/tracking, other things like hide cursor on click can be toggled on and off on the JS script and the camera in game responds, just dosn't follow the player (I am guessing that this is because of the prefab/object that the camera is parented too? - I only did that as JS mentioned a camera prefab with a camera component, maybe this has been my issue).

    When I pause in the editor I can see three cameras have now appeared. 1. The main camera, 2. A player 123456 (clone) camera, 3. and a camera just called "camera" floating above.

    I think # 2 is an ORK one? and the camera floating from a top down view is the JS one created because ork takes a new instance (clone) of the player prefab and this means the JS script now has no camera assigned and hence creates one as its meant to.

    Scenario two. (I remove the camera from the prefab and place it in the same spot (and delete the prefab).
    When I place the camera only (i.e. screen preview, not parented to an object/prefab called main camera), I get this really wierd effect where as soon as the scene spawns it starts to crazily zoom out until in just a few seconds I cant see the level anymore and Im left in the sky lol. What is going on? Interestingly I can replicate this by putting a JS camera controller script (which usually goes on your player) and then referencing the same camera this script is on in any scene, and you get the same endless zoom effect.

    Here is another video encase somebody can see an obvious mistake I'm making.

    Post edited by Phesant33 on
  • Ok new approach = use the mouse camera controller GiL provides with ORK. No slight against JS who has been super helpful but this is just right for me, spent way to much time on this already. Incidently all HP hud now working in all scenes :)
  • @Phesant33 I'm glad you found a solution with GiL's controller. I thought I'd answer your previous post as best I could though just for the record so maybe it could help other people dealing with it :)

    To clarify, all I've done to get JS MMO controller to work as far as the camera and player prefab are concerned is the following:

    1.) Place his 3 scripts on the player: RPG Controller, RPG Motor and RPG Camera. Adjust the settings as needed for walk speed etc.

    2.) Camera: use the "Main Camera" in your scene. Be sure it's tagged "MainCamera". Technically you can name it anything you want as long as it's tagged. Add any effects you want. E.g. Lens Flare etc. Do not add the camera to any of the scripts on the player. The reason for this is his RPGCamera script will find the camera is the Awake() statement:
    if (Camera.main == null) {
    GameObject mainCamera = new GameObject("Main Camera");
    mainCamera.AddComponent();
    mainCamera.tag = "MainCamera";
    }
    Now I do not have the very latest version of his MMO controller but, at least in his previous updates, this had not changed and pretty straight forward, hopefully :).

    I hope this helps to some degree.
  • I just wanted to update my above statement. It appears in the latest version of the MMO controller, John has adjusted his Awake() method to look for the camera object to be added in the inspector of the RPGCamera script. If that works for you then that's great :)

    I prefer to have the option to use different cameras in different scenes. Maybe I want a different effect indoors than outdoors and so on. So I added the following to my code in the RPGCamera.cs > Awake() method. NOTE: I included the some of the original code for context:
    private void Awake()
    {
    //-------------------------------------------------
    /*This will add the current camera that is already in the scene.
    Be sure to tag the camera as MainCamera*/
    //get all cameras in the scene in the event we have more than one camera
    var cameraGameObjects = FindObjectsOfType();
    foreach (var cameraObj in cameraGameObjects)
    {
    //only use tagged "MainCamera"
    if (cameraObj.tag == "MainCamera")
    {
    cameraObj.transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0);
    UsedCamera = cameraObj;
    }
    }
    //-------------------------------------------------
    //Original code starts below here -----------------
    // Check if there is a prescribed camera to use
    if (UsedCamera == null) {
    // Create one for usage in the following code
    I hope this helps someone. I haven't had any issues with it so far.

    Thanks!
Sign In or Register to comment.