edited February 2014 in ORK Support
I have a control setup that's working pretty good, however it involves the camera being parented to the player. The problem is when the player levels up the camera gets unparented and just floats in the scene. Does anyone know how to keep this from happening?
Post edited by gamingislove on
  • Strange, usually leveling up shouldn't unparent anything, I'll look into it.

    To prevent this, you can automatically parent the camera to the player in your camera control script.
    Small code example (add it to your camera control script's Update or FixedUpdate function):

    if(this.transform.parent == null)
    {
    GameObject player = ORK.Game.GetPlayer();
    if(player != null)
    {
    this.transform.parent = player.transform;
    // if needed, update the camera's position to the player here
    }
    }
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yea I've tried a couple different camera scripts but they both required being parented to the player and they both got unparented on level up. It even happens if I use the default ORK character controller.

    I was able to get the bit of code you gave me to reparent the camera, but the rotation was off center. Also it's the kind of solution that generally makes me nervous. thanks for the help though.
  • I did a quick test and my camera didn't get unparented on level up - does this only occur in battle or also if you do it in an event?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • It happens during battle, I'm using real time combat with a Real Time Battle Area with player and camera control only blocked during menus. I just tried leveling up with an event and the camera stays parented. So it only happens when I level up from combat.
  • Still doesn't happen on my end - are you sure you the camera doesn't get uparented in one of your battle events?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I figured it out! The enemy death animation was the same one from the tutorial, and it was resetting the camera position. Thanks for pointing me in the right direction!
  • Great, thought it would be strange if level up would do anything to the camera :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.