Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davecdempsey/287df2b698a2ca6e80275307b200de01 to your computer and use it in GitHub Desktop.
Save davecdempsey/287df2b698a2ca6e80275307b200de01 to your computer and use it in GitHub Desktop.
KineMovement implements the BaseCharacterController for Kine Character Controller. Follow how SetInput get the input and preps to apply it in the method UpdateVelocity for the CharcterController. This gets set in PlayerControlsVisualizer for the client side through the character visualizer. Same with the server and remote client behaviors in Cha…

KineMovement implements the BaseCharacterController for Kine Character Controller. Follow how SetInput get the input and preps to apply it in the method UpdateVelocity for the CharcterController. This gets set in PlayerControlsVisualizer for the client side through the character visualizer. Same with the server and remote client behaviors in CharacterMovementBehavior.cs

using Improbable;
using UnityEngine;
using Improbable.Character;
using Improbable.Gdk.GameObjectRepresentation;
using Improbable.Gdk.TransformSynchronization;
using Improbable.Worker.CInterop;
public class CharacterMovementBehavior : MonoBehaviour {
[Require]
protected MovementState.Requirable.Reader MovementStateReader;
[Require]
private Health.Requirable.Reader HealthReader;
public CharacterVisualizer CharacterVisualizer;
//[SerializeField]
//public Rigidbody Rigidbody;
void OnEnable()
{
if (CharacterVisualizer.Movement != null)
{
CharacterVisualizer.Movement.ToggleWalk(!MovementStateReader.Data.Run);
CharacterVisualizer.Movement.ToggleCrouch(MovementStateReader.Data.Crouch);
}
MovementStateReader.ComponentUpdated += (MovementStateReader_ComponentUpdated);
MovementStateReader.OnJump += MovementStateReader_OnJump;
}
void OnDisable()
{
}
private void MovementStateReader_OnJump(Jump jump)
{
CharacterVisualizer.Movement.TriggerJump();
}
private void MovementStateReader_ComponentUpdated(MovementState.Update update)
{
if(CharacterVisualizer.Movement == null)
return;
if (update.Crouch.HasValue)
{
CharacterVisualizer.Movement.ToggleCrouch(update.Crouch.Value);
}
if (update.Run.HasValue)
{
CharacterVisualizer.Movement.ToggleWalk(!update.Run.Value);
}
//if (update.targetPosition.HasValue)
//{
// if (ShouldMovePlayerFSim(update.targetPosition.Value.ToVector3(), transform.position))
// {
// var targetPos = update.targetPosition.Value.ToVector3();
// if (PlayerMovementCheatSafeguardPassedFSim(targetPos, transform.position))
// {
// transform.position = targetPos;
// //myRigidbody.MovePosition(targetPos);
// }
// else
// {
// transformWriter.Update.(myRigidbody.position);
// }
// }
//}
}
void Update()
{
if (CharacterVisualizer.Movement != null)
{
//CharacterVisualizer.Movement.DeadState = HealthReader.Data.dead;
//CharacterVisualizer.Movement.Stunned = HealthReader.Data.stunTimer > 0;
//CharacterVisualizer.Movement.fromRigidbodyVelocity = !MovementStateReader.HasAuthority;
CharacterVisualizer.Movement.ToggleWalk(!MovementStateReader.Data.Run);
CharacterVisualizer.Movement.ToggleCrouch(MovementStateReader.Data.Crouch);
if (MovementStateReader.Authority == Authority.NotAuthoritative)
{
CharacterVisualizer.Movement.SetInput(MovementStateReader.Data.MovementDirection.ToUnityVector3(), Vector3.zero, new Vector3(0,
MovementStateReader.Data.Heading, 0));
}
}
}
}
using System;
using System.Collections.Generic;
using KinematicCharacterController;
using Twokinds.Assets._Game.Scripts.Movement;
using Twokinds.Assets._Game.Scripts.MovementKine.Actions;
using Twokinds.Assets._Game.Scripts.MovementKine.Stances;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Events;
namespace Twokinds.Assets._Game.Scripts.MovementKine
{
public class KineMovement : BaseCharacterController
{
public Transform MovementTransform { get { return transform; } }
public Vector3 MovementInput
{
get { return _movementInput; }
}
public bool Walk { get { return _walk; } }
//order by priority. Top has say, second overlays with top mask
public List<BaseStanceKine> Stance { get; private set; }
public Vector3[] LastGoodGround = new Vector3[3];
public event UnityAction<ActionEffects> OnTriggerAction;
public event UnityAction<ActionEffects> OnEndAction;
public int ComboMax { get; private set; }
public AttackType AttackType { get; private set; }
public bool TwoHands { get; private set; }
public float MoveSpeed
{
get
{
if (Stance.Count < 1)
{
return _moveSpeed;
}
var speed = Stance[0].MovementSpeed;
for (int cnt = 1; cnt < Stance.Count; cnt++)
{
if (Stance[cnt].MovementSpeed < speed)
{
speed = Stance[cnt].MovementSpeed;
}
}
return _moveSpeed * speed;
}
}
public Vector3 LocalVelocity
{
get { return _localVelocity; }
}
public float ReverseAdjust
{
get
{
if (Stance.Count < 1)
{
return .33f;
}
var speed = Stance[0].ReverseSpeed;
for (int cnt = 1; cnt < Stance.Count; cnt++)
{
if (Stance[cnt].ReverseSpeed < speed)
{
speed = Stance[cnt].ReverseSpeed;
}
}
return speed;
}
}
public BaseActionKine Action
{
get { return _action; }
}
public Animator Animator;
public Transform CameraTarget;
[SerializeField]
private DefaultStance _defaultStance = DefaultStance.Standard;
private Type _defaultStanceType;
private int _jumpCount = 1;
private BaseActionKine _action;
[Header("Movement")]
[SerializeField]
float _moveSpeed = 10;
float _stableMovementSharpness = 15;
[SerializeField]
private bool _walk;
[SerializeField]
private Vector3 _desiredRotation;
[SerializeField]
private Vector3 _rotationInput;
[SerializeField]
private Vector3 _movementInput;
private Vector3 _localVelocity;
public List<Collider> IgnoredColliders = new List<Collider>();
[Header("Air Movement")]
public float MaxAirMoveSpeed = 10f;
public float AirAccelerationSpeed = 5f;
public float Drag = 0.1f;
public Vector3 Gravity = new Vector3(0, -30f, 0);
[Header("Network Settings")]
public bool Networked;
private float _cameraUpdateFollowEnd = 0;
void Awake()
{
Stance = new List<BaseStanceKine>();
SetMaxCombo(3);
if (CameraTarget == null)
{
CameraTarget = new GameObject("Camera Target").transform;
CameraTarget.parent = transform;
CameraTarget.localPosition = Vector3.up;
CameraTarget.localRotation = Quaternion.identity;
}
}
// Use this for initialization
void Start () {
BaseStanceKine defStance;
if (_defaultStance == DefaultStance.Horse)
{
//defStance = new HorseStanceKine(this);
defStance = new HorseStance(this);
_defaultStanceType = defStance.GetType();
}
else
{
//standard
defStance = new StandardStanceKine(this);
}
_defaultStanceType = defStance.GetType();
Debug.Log(_defaultStanceType.ToString());
SetStance(defStance);
}
// Update is called once per frame
void Update () {
if (Motor.GroundingStatus.IsStableOnGround && (Action == null || Action.PreventJumpReset == false))
{
if (_jumpCount != 1)
{
Debug.Log("Resetting jump counter");
}
_jumpCount = 1;
}
else if (Motor.GroundingStatus.IsStableOnGround == false && Motor.BaseVelocity.y < -.15f && StanceActive<FallStance>() == false)
{
//fall animation
SetStance(new FallStance(this));
}
if (_action != null)
{
_action.Update();
return;
}
for (int cnt = 0; cnt < Stance.Count; cnt++)
{
Stance[cnt].Update();
if (!Stance[cnt].AllowSub)
{
break;
}
}
}
public bool StanceActive<T>() where T : BaseStanceKine
{
for (int cnt = 0; cnt < Stance.Count; cnt++)
{
if (Stance[cnt] is T)
{
return true;
}
}
return false;
}
public void SetStance(BaseStanceKine stance)
{
Stance.Add(stance);
Stance.Sort((s1, s2) => s1.Priority.CompareTo(s2.Priority));
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="stance"></param>
/// <returns>True if Active, fals if not</returns>
public bool ToggleStance<T>(T stance = null) where T : BaseStanceKine
{
if (typeof(T) == _defaultStanceType)
return true;
for (int cnt = 0; cnt < Stance.Count; cnt++)
{
if (Stance[cnt] is T)
{
Stance.RemoveAt(cnt);
return false;
}
}
if (stance == null)
{
return false;
}
SetStance(stance);
return true;
}
public override void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
{
if (Time.time < _cameraUpdateFollowEnd)
{
if (_action != null && _action.LockRotation)
{
_desiredRotation = currentRotation.eulerAngles;
}
float orientationSharpness = 10;
var rot = Quaternion.Euler(_desiredRotation) * Vector3.forward;
// Smoothly interpolate from current to target look direction
Vector3 smoothedLookInputDirection = Vector3
.Slerp(Motor.CharacterForward, rot, 1 - Mathf.Exp(-orientationSharpness * deltaTime)).normalized;
// Set the current rotation (which will be used by the KinematicCharacterMotor)
currentRotation = Quaternion.LookRotation(smoothedLookInputDirection, Motor.CharacterUp);
}
}
public override void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
{
Vector3 targetMovementVelocity = Vector3.zero;
// Ground movement
if (Motor.GroundingStatus.IsStableOnGround)
{
SaveGroundPoint(Motor.transform.position);
var movementInput = _movementInput;
if (_action != null && _action.LockMovement)
{
movementInput = Vector3.zero;
}
if (Stance[0].LimitStrafe)
{
movementInput.x = 0;
}
if (_walk)
{
movementInput /= 3f;
//movementInput.x = Mathf.Clamp(movementInput.x, -.3f, .3f);
//movementInput.y = Mathf.Clamp(movementInput.y, -.3f, .3f);
//movementInput.z = Mathf.Clamp(movementInput.z, -.3f, .3f);
}
//move in direction of desired rotation
movementInput = Quaternion.Euler(_desiredRotation) * movementInput;
Vector3 effectiveGroundNormal = Motor.GroundingStatus.GroundNormal;
if (currentVelocity.sqrMagnitude > 0f && Motor.GroundingStatus.SnappingPrevented)
{
// Take the normal from where we're coming from
Vector3 groundPointToCharacter = Motor.TransientPosition - Motor.GroundingStatus.GroundPoint;
if (Vector3.Dot(currentVelocity, groundPointToCharacter) >= 0f)
{
effectiveGroundNormal = Motor.GroundingStatus.OuterGroundNormal;
}
else
{
effectiveGroundNormal = Motor.GroundingStatus.InnerGroundNormal;
}
}
// Reorient velocity on slope
currentVelocity = Motor.GetDirectionTangentToSurface(currentVelocity, effectiveGroundNormal) * currentVelocity.magnitude;
// Calculate target velocity
Vector3 inputRight = Vector3.Cross(movementInput, Motor.CharacterUp);
//Debug.Log(inputRight);
Vector3 reorientedInput = Vector3.Cross(effectiveGroundNormal, inputRight).normalized * movementInput.magnitude;
targetMovementVelocity = reorientedInput * MoveSpeed;
var localVel = Motor.Transform.InverseTransformDirection(targetMovementVelocity);
localVel.z = Mathf.Clamp(localVel.z, - _moveSpeed * ReverseAdjust, MoveSpeed);
_localVelocity = localVel;
targetMovementVelocity = Motor.Transform.TransformDirection(localVel);
// Smooth movement Velocity
currentVelocity = Vector3.Lerp(currentVelocity, targetMovementVelocity, 1 - Mathf.Exp(-_stableMovementSharpness * deltaTime));
}
// Air movement
else
{
//move in direction of desired rotation
var movementInput = Quaternion.Euler(_desiredRotation) * _movementInput;
if (_action != null && _action.LockMovement)
{
movementInput = Vector3.zero;
}
// Add move input
if (movementInput.sqrMagnitude > 0f)
{
targetMovementVelocity = movementInput * MaxAirMoveSpeed;
// Prevent climbing on un-stable slopes with air movement
if (Motor.GroundingStatus.FoundAnyGround)
{
Vector3 perpenticularObstructionNormal = Vector3.Cross(Vector3.Cross(Motor.CharacterUp, Motor.GroundingStatus.GroundNormal), Motor.CharacterUp).normalized;
targetMovementVelocity = Vector3.ProjectOnPlane(targetMovementVelocity, perpenticularObstructionNormal);
}
_localVelocity = targetMovementVelocity;
Vector3 velocityDiff = Vector3.ProjectOnPlane(targetMovementVelocity - currentVelocity, Gravity);
currentVelocity += velocityDiff * AirAccelerationSpeed * deltaTime;
}
// Gravity
currentVelocity += Gravity * deltaTime;
if (currentVelocity.y < 0)
{
if (!Physics.Raycast(new Ray(transform.position, Vector3.down), 10000, ~(1 << 12)))
{
//stop falling
currentVelocity.y = 0;
}
}
// Drag
currentVelocity *= (1f / (1f + (Drag * deltaTime)));
}
if (_action != null)
{
_action.Trigger(ref currentVelocity);
}
}
private void SaveGroundPoint(Vector3 position)
{
if(Mathf.Abs((LastGoodGround[0] - position).sqrMagnitude) < 2)
return;
//maybe use a queue in the future
//skip the last
for (int cnt = LastGoodGround.Length - 2; cnt >= 0; cnt--)
{
LastGoodGround[cnt + 1] = LastGoodGround[cnt];
}
LastGoodGround[0] = position;
}
public override void BeforeCharacterUpdate(float deltaTime)
{
}
public override void PostGroundingUpdate(float deltaTime)
{
}
public override void AfterCharacterUpdate(float deltaTime)
{
}
public override bool IsColliderValidForCollisions(Collider coll)
{
if (IgnoredColliders.Count == 0)
{
return true;
}
if (IgnoredColliders.Contains(coll))
{
return false;
}
return true;
}
public override void OnGroundHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport)
{
}
public override void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,
ref HitStabilityReport hitStabilityReport)
{
}
public override void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, Vector3 atCharacterPosition,
Quaternion atCharacterRotation, ref HitStabilityReport hitStabilityReport)
{
}
public void SetInput(Vector3 input, Vector3 rotationInput, Vector3 desiredRotation)
{
rotationInput.x = 0;
rotationInput.z = 0;
desiredRotation.x = 0;
desiredRotation.z = 0;
_desiredRotation = desiredRotation;
_rotationInput = rotationInput;
//input = Quaternion.Euler(_desiredRotation) * input;
Vector3 moveInputVector = Vector3.ClampMagnitude(new Vector3(input.x, 0f, input.z), 1f);
_movementInput = moveInputVector;
if (_rotationInput.magnitude > 0)
{
_cameraUpdateFollowEnd = Time.time + 0.25f;
}
}
public void ToggleCrouch(bool? crouch = null)
{
if (!crouch.HasValue)
{
ToggleStance(new SneakStance(this));
return;
}
if (crouch.Value)
{
ToggleStance(new SneakStance(this));
}
ToggleStance<SneakStance>(null);
}
public void TriggerJump()
{
if (_jumpCount < 1)
return;
if (_action != null)
{
if (!_action.Interruptable)
return;
_action.Interrupt();
}
_action = new JumpAction(this);
_jumpCount--;
}
public void SetAction(BaseActionKine action)
{
if (_action != null)
{
_action.Interrupt();
}
_action = action;
SetupActionEvents();
if (_action == null)
{
//_motion.ChangeAnimation(_motion.Animation);
}
}
void SetupActionEvents()
{
if(_action == null)
return;
_action.OnTriggerAction += OnTriggerAction;
_action.OnEndAction += OnEndAction;
}
void RemoveActionEvents()
{
if (_action == null)
return;
_action.OnTriggerAction -= OnTriggerAction;
_action.OnEndAction -= OnEndAction;
}
public void ToggleWalk(bool walk)
{
_walk = walk;
}
public void RemoveAction(BaseActionKine action)
{
if(action == null)
return;
if (action.Equals(_action))
{
_action.Reset();
}
Debug.Log($"Removed Action: {action.GetType()}");
RemoveActionEvents();
_action = null;
}
public void SetMaxCombo(int comboMax)
{
ComboMax = comboMax;
}
public void WeaponAttackType(AttackType attackType, bool twoHands)
{
AttackType = attackType;
TwoHands = twoHands;
}
}
}
using System;
using Assets.Gamelogic.Communication;
using Assets.Gamelogic.Core;
using Assets.Gamelogic.UI;
using Scripts.Core;
using Improbable.Character;
using Improbable;
using Improbable.Gdk.Core;
using Improbable.Gdk.GameObjectRepresentation;
using Improbable.Gdk.TransformSynchronization;
using Improbable.Skill;
using Improbable.Transform;
using Twokinds.Assets._Game.Scripts.CameraSystems;
using Twokinds.Assets._Game.Scripts.Character.InControl;
using UnityEngine;
//using Vector3 = Improbable.Math.Vector3d;
namespace Assets.Gamelogic.Visualizers
{
public class PlayerControlsVisualizer : MonoBehaviour
{
//[Require] protected LocalPlayerCheckStateWriter LocalPlayerCheck;
[Require] protected MovementState.Requirable.Writer movementStateWriter;
[Require] protected Health.Requirable.Reader HealthReader;
[Require]
protected AttackState.Requirable.Writer attackStateWriter;
[Require]
protected CharacterLook.Requirable.Writer CharacterLookWriter;
[Require] protected SkillList.Requirable.Reader SkillListReader;
private CameraSystem cameraOrbit;
[SerializeField]
private SendChatBehaviour sendChatBehaviour;
//private Transform cameraMount;
//private KGFOrbitCam orbitCam;
private bool run = true;
private bool crouch = false;
public CharacterVisualizer CharacterVisualizer;
private CharacterActionsTk _characterActions;
protected void OnEnable()
{
AttachCamera();
_characterActions = new CharacterActionsTk();
_characterActions.SetupDefaultsAll();
}
protected void OnDisable()
{
RemoveCamera();
if (_characterActions != null)
{
_characterActions.Destroy();
}
}
public void Update()
{
var movementDirection = GetMovementDirection();
var movementUpdater = new MovementState.Update() {MovementDirection = movementDirection};
if (CharacterVisualizer != null && CharacterVisualizer.Movement != null)
{
//if (cameraMount == null)
//{
// SetupCameraMount();
//}
var camera = Camera.main;
var rot = new Vector3(0, camera.transform.eulerAngles.y, 0);
Vector3 rotationInput = rot - transform.rotation.eulerAngles;
var desiredRot = new Vector3(0, camera.transform.eulerAngles.y, 0);
if (_characterActions.CameraOnlyRotation.IsPressed)
{
rotationInput = Vector3.zero;
desiredRot = CharacterVisualizer.Movement.Motor.Transform.eulerAngles;
}
CharacterVisualizer.Movement.SetInput(movementDirection.ToUnityVector3(), rotationInput, desiredRot);
//if (HealthReader.Data.dead == DeadState.Alive && MenuManager.AnythingOpen == false && !Input.GetMouseButton(2))
//{
// //CharacterVisualizer.Movement.MovementTransform.eulerAngles = new Vector3(0, camera.transform.eulerAngles.y, 0);
// //.Rotate(new Vector3(0, Input.GetAxis("Mouse X") * 180 * Time.deltaTime, 0));
//}
movementUpdater.Heading = (transform.eulerAngles.y);
movementUpdater.TargetPosition = (CharacterVisualizer.Movement.MovementTransform.position.ToImprobableLocation().ToSpatialCoords());
}
if (MenuManager.AnythingOpen == false && !ChatPanelController.ChatModeActive)
{
if (_characterActions.Jump.WasPressed)
{
movementStateWriter.SendJump(new Jump());
}
if (_characterActions.Crouch.WasPressed)
{
crouch = !crouch;
movementUpdater.Crouch = new Option<BlittableBool>(crouch);
}
if (_characterActions.Walk.WasPressed)
{
run = !run;
movementUpdater.Run = new Option<BlittableBool>(run);
}
//if (_characterActions.HotkeysAlt[1].WasPressed)
//{
// movementUpdater = movementUpdater.AddEmote(new Emote((int)ActionCode.Wave));
//}
//if (_characterActions.HotkeysAlt[2].WasPressed)
//{
// movementUpdater = movementUpdater.AddEmote(new Emote((int)ActionCode.Cheer));
//}
//if (_characterActions.HotkeysAlt[3].WasPressed)
//{
// movementUpdater = movementUpdater.AddEmote(new Emote((int)ActionCode.Dance));
//}
if (_characterActions.Action1.WasPressed)
{
attackStateWriter.SendUseSkill(new UseSkill(3, UseSkillSetting.On)); //strike
}
if (_characterActions.Action2.WasPressed)
{
attackStateWriter.SendUseSkill(new UseSkill(2, UseSkillSetting.On)); //block
}
if (_characterActions.Action2.WasReleased)
{
attackStateWriter.SendUseSkill(new UseSkill(2, UseSkillSetting.Off)); //block
}
}
if (!ChatPanelController.ChatModeActive && SkillBar.Instance != null)
{
for (int cnt = 0; cnt < SkillBar.Instance.icons.Count && cnt < _characterActions.Hotkeys.Length; cnt++)
{
if (SkillBar.Instance.icons[cnt].skill.HasValue && _characterActions.Hotkeys[cnt].WasPressed)
{
attackStateWriter.SendUseSkill(new UseSkill(SkillBar.Instance.icons[cnt].skill.Value, UseSkillSetting.Toggle)); //skills TM
}
}
}
movementStateWriter.Send(movementUpdater);
if (Input.GetKeyDown(SimulationSettings.SubmitChatKey))
{
if (ChatPanelController.ChatModeActive)
{
var message = ChatPanelController.SubmitChat();
if (message.Length > 0)
{
sendChatBehaviour.SayChat(message);
ChatPanelController.ActivateChatMode();
}
else
{
ChatPanelController.DeactivateChatMode();
}
}
else
{
ChatPanelController.ActivateChatMode();
}
}
if (Input.GetKeyDown(SimulationSettings.AbortKey) && ChatPanelController.ChatModeActive)
{
ChatPanelController.DeactivateChatMode();
}
SetupCameraMount();
//drag camera round
if (CharacterVisualizer != null && CharacterVisualizer.Movement != null && cameraOrbit.Target != null)
{
//var camera = Camera.main;
cameraOrbit.Target.position = CharacterVisualizer.Movement.CameraTarget.position;
cameraOrbit.Target.rotation = CharacterVisualizer.Movement.CameraTarget.rotation;
//orbitCam = camera.GetComponent<KGFOrbitCam>();
//orbitCam.itsTarget.itsTarget.transform.parent = Movement.cameraTarget.transform;
//orbitCam.itsTarget.itsTarget.transform.localPosition = Vector3.zero;
//orbitCam.itsTarget.itsTarget.transform.localRotation = Quaternion.identity;
//cameraMount = camera.transform.parent;
}
}
void FixedUpdate()
{
var lookRot = cameraOrbit.transform.rotation.eulerAngles - transform.rotation.eulerAngles;//(cameraOrbit.transform.rotation * Quaternion.Inverse(transform.rotation)).eulerAngles;
var lookUpdate = new CharacterLook.Update() {X = lookRot.x, Y = lookRot.y, Z = lookRot.z};
if (lookRot.x != CharacterLookWriter.Data.X || lookRot.y != CharacterLookWriter.Data.Y ||
lookRot.z != CharacterLookWriter.Data.Z)
{
CharacterLookWriter.Send(lookUpdate);
}
}
//void LateUpdate()
//{
//}
private Velocity GetMovementDirection()
{
if (ChatPanelController.ChatModeActive)
{
return new Velocity();
}
return new Velocity(_characterActions.Move.X, 0, _characterActions.Move.Y);
}
void SetupCameraMount()
{
if (CharacterVisualizer != null)
{
if (CharacterVisualizer.Movement != null && cameraOrbit.Target == null)
{
//shouldnt be null.
cameraOrbit.Target = CharacterVisualizer.Movement.CameraTarget.transform;
}
}
else
{
cameraOrbit.Target = transform;
}
//cameraMount = new GameObject("Camera Mount").transform;
//cameraMount.localPosition = new Vector3(0, 1.6f, 0);
//cameraMount.localRotation = Quaternion.identity;
}
private void AttachCamera()
{
cameraOrbit = Camera.main.GetComponent<CameraSystem>();
InteractionManager.instance.character = CharacterVisualizer;
}
private void RemoveCamera()
{
InteractionManager.instance.character = null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment