Experimental Terraworld Adapters

Terraworld is a paid asset that allows you to generate huge terrains with the help of satelite maps. You can create stylistic or realistic environments.

TerraWorld – Automated Level Designer | Terrain | Unity Asset Store

The terraworld adapters makes the Nonon Zone Character Controller ready to use for that asset.

Functionality

In the “Assets –> NononCharacterController –> Scripts –> Adaptors” folder you will find the following two scripts

  • TWPlayerInteractions: This script sets the player to the scene and makes it interactable with objects. This lets the player collide with Trees, Rocks etc.
  • Experimental: All lines are commented out. To use the adaptor make this steps:
    – Add the script to the player prefab
    – Uncomment the blocks with /* */
    – In the “InteractiveTargets.cs” file from Terraworld delete the pragmas “#if UNITY_EDITOR” and “#endif”
    – That’s it. Generate a terrain and playe a player with “Add player with dependencies to scene”. Adjust the spawn points and hit run.
  • TWSunControlNetwork: This script synchronizes the sun between the server and all players in the scene in a multiplayer setup.

    Experimental: You need to make different methods public to work for this. To use the adaptor make this steps:
    – Add the script to NononZoneGameControllerNetwork object in the scene or any object that is not dynamic (create an empty one if needed). Add a NetworkObject on it as well if asked.
    – Uncomment the blocks with /* */
    – In the class TimeOfDay.cs make the method “GetScript()” public
    – Add the methods below to the class on line 274 and the sun will be synced to your players and set correctly.

public void SetSunSteps(float sunSteps)
{
_SunSteps = sunSteps;
}
public float GetSunSteps()
{
  return _SunSteps;
}

Additionally to that you need to make adjustments when the Camera is deactivated on the server

TCameraManager.cs
Line66: Comment the Camera Exception Block

 /*if (_currentCamera == null)
                
                throw new Exception("No cameras found in scene!");*/

Line74: Comment the Camera Exception Block

/*if (Camera.main == null)                 
throw new Exception("Camera with tag \"MainCamera\" not found in scene!"); else*/             return Camera.main; 

TScatterParams.cs

Line 948: Make a Check for null Camera

if (localCullingGroup != null && TCameraManager.MainCamera != null) localCullingGroup.SetDistanceReferencePoint(TCameraManager.MainCamera.transform.position);

0 Comments

Leave a Reply

Avatar placeholder