Good morning! Up until now, I've been using the 1st Person camera with a -z offset to simulate a 3rd Person mouse and button cam. I just bought this https://assetstore.unity.com/packages/tools/camera/3rd-person-camera-controller-74879 cam controller and can't seem to get it to work. I'd really appreciate any ideas on how to make it operational. Thanks!! :)
  • Looking at the images in the asset store, it seems like the camera needs an already spawned player/target, so you'll most likely need to either adjust the code of the controller or write a small script (component).

    What you need to have the script do is get ORK's player and set it as the controller's target. You can get the player's game object like this:
    GameObject player = ORK.Game.GetPlayer();
    If the player isn't spawned yet, it'll return null.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks GiL! I'll try it out later today. :)
  • If you get it to work I would appreciate some more detailed instructions on how you did it instead of GameObject player = ORK.Game.GetPlayer(); which really isnt much help at all to someone beginning with this asset. I could never get the camera to work instead I ended up using the Invector 3rd person controller/camera integration. This brings in other issues though.
  • edited April 19
    Here's a quick example wrapper component:

    using UnityEngine;
    using ORKFramework;

    public class CameraWrapper : MonoBehaviour
    {
    private CameraControlComponent cameraControl;

    private void Start()
    {
    this.cameraControl = this.GetComponent<CameraControlComponent>();
    if(this.cameraControl == null)
    {
    this.enabled = false;
    }
    }

    private void Update()
    {
    if(this.cameraControl.target == null)
    {
    GameObject player = ORK.Game.GetPlayer();
    if(player != null)
    {
    this.cameraControl.target = player;
    }
    }
    }
    }


    Replace CameraControlComponent with the class name of your custom camera control component. Depending in the component's fields/properties, you might need to replace this.cameraControl.target with whatever field/property is used to define the camera's target (e.g. this.cameraControl.cameraTarget).

    Add it to your camera (or wherever the control component is attached to) - it'll set the camera's target to the player. For blocking camera controls via ORK, you still need to do the custom control setup :)
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.