public override void CreateEntity(string entityName = "PlayerObj") { // Setup the player EntityAgent & rigidbody // transform.eulerAngles = new Vector2(90, 0); entityObj = gameObject; entityRigidbody = entityObj.AddComponent <Rigidbody>(); entityRigidbody.interpolation = RigidbodyInterpolation.Interpolate; entityRigidbody.freezeRotation = true; entityRigidbody.transform.SetParent(transform); entityRigidbody.useGravity = false; entityRigidbody.drag = 9; // //entityBoxCollider = entityObj.AddComponent<BoxCollider>(); //entityBoxCollider.size = new Vector3(0.24f,2,0.48f); entityFeetCollider = new GameObject("Feet").AddComponent <CapsuleCollider>(); entityFeetCollider.gameObject.transform.SetParent(entityObj.transform); entityFeetCollider.transform.localPosition = new Vector3(0, 0, 0); entityFeetCollider.radius = 0.06f; entityFeetCollider.height = 2; entityFeetCollider.tag = "feet"; // Setup a new camera obj playerCameraObj = CameraManager.SetupNewCamera(ScenePrimer.curPrimerComponent.primerParrentObj, "PlayerCamera", true, true, 1, new Color(), new Vector3(entityObj.transform.position.x, 2, entityObj.transform.position.z), new Vector3(90, 0, 0)); playerCameraObj.AddComponent <OldZoom>(); playerCameraObj.AddComponent <ObjectFollow>().target = transform; // Add the BPlayerController to the camera. targetPlayerController = SessionManager.CreateBPlayerController(playerCameraObj); targetPlayerController.ControllerUpdateMode(true); targetPlayerController.targetEntityAgent = this; targetPlayerController.targetRigidbody = entityRigidbody; targetPlayerController.targetCameraObj = playerCameraObj; targetPlayerController.targetCamera = playerCameraObj.GetComponent <Camera>(); targetPlayerController.targetCamera.backgroundColor = MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].bgColor); PlayerSetupTextures(); }