Jump to content

Problem with loading character controller

Marcin Debicki

Recommended Posts

Hello, I have a problem with lading properly a character controller.

Basically in order to save resources (and try to avoid loading unneeded terrains) what I try to do:

  1. I have GameManager object which is checking what location should be loaded.
  2. If GameManager cannot determine location (for instance I am not loading any save game) then location of existing object called PlayerLocation is used. I ensure in editor that PlayerLocation is placed above some terrain.
  3. GameManager instantiates prefab Player in given location. This Prefab is a single object containing actual character controller, RigidBody, TerrainLoader and RigidBodyWaitForTerrainLoad.

Here is how it works:

  • If PlayerLocation is in world origin (0,0,0) then everything works just fine
  • If PlayerLocation is in some other location requiring some other tiles to load then:
    • Loading screen does not even progress.
    • RigidBodyWaitForTerrainLoad decides that terrain is already loaded so loading character controller eventually progresses however stil character object falls through terrain.

I have noticed some strange behavior of terrains as they are also being moved for some reason so I am now disabling floating point fix but otherwise I am out of ideas what may be wrong.

Link to comment
Share on other sites

To answer my own question (part answer). After I disabled floating point fix it seems that actual controller is loading properly however still from time to time loading screen does not disappear (at least when playing in editor).

Link to comment
Share on other sites

Did you change to your own player/char?

Is it still a child of the Gaia Runtime, Gaia Player.  The world Origin for the RigidbodyWaitForTerrainLoad for the Player is derived from the parent GO, in this case the Gaia Runtime believe it or not (discovered this after many issues myself with the scene player and the wait for terrain load -- actual made my own version of the wait for terrain load to help it along a little).

Go into your Terrain Loader Manager and then select the + Terrains foldout and then select unload all terrains.  Then go back up to where you designate the loading distance and for test purposes, use something like 185.  The minute you key in 1, the terrain will start loading based off the world origin, if you have the center off world origin option selected.  If you are using scene view then it should just load in right at your players position wherever that may be.

In terms of the loading screen not working right.. Try this also... enable it in the scene view, in edit mode.  re-enter play mode and see if that works.  Sometimes, at least from what I've seen it gets bugged to enable and disable as well as update... Even then it still is a little buggy.. I've had to manually turn it off in editor play mode and having done that once or twice seems to clear the issue;- which is strange.

Is the your player tagged as "Player"? If so then if your player is still falling through then there is most likely an issue with your collider on the player.

Link to comment
Share on other sites

Regarding character falling through. All my testing was done both with controller object being instantiated as Gaia Player child as well as controller object put at top level. The problem was always the same: controller object was instantiated at right location. Proper terrains were also loaded however terrains for some weird reason always ended up in wrong location. While in my case X should be -6000 (location of player as well as location of terrain if loaded in editor scene view by Gaia) it always ended up elsewhere with values of X anywhere between 0 and 1 000 000. However as I said disabling floating point fix seem to fixed that and now this part works as intended.

For loading screen I have tried this already (and yes, in most cases it indeed works) but no luck. Every single time terrains load properly however progress bar does not get updated as well as loading screen does not disappear in the end. It looks that while loading process is done successfully still some part of code is not executed while it should.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

  • Create New...