change: altered camera for smoother and more responsive lock-on (mainly jitter from the arbitrary target, locking rotation)
This commit is contained in:
@@ -6,14 +6,44 @@ public interface ILockOnTarget {
|
||||
|
||||
Transform transform {get;}
|
||||
GameObject gameObject{ get; }
|
||||
|
||||
abstract void OnTargetDelete();
|
||||
|
||||
void Help(){
|
||||
SafelyDeleteTarget();
|
||||
}
|
||||
|
||||
public Vector3 GetReticlePosition(){
|
||||
Bounds objectBounds = gameObject.GetComponent<Renderer>().bounds;
|
||||
float upValue = 0f;
|
||||
|
||||
if (gameObject.GetComponent<Renderer>()){
|
||||
Bounds objectBounds = gameObject.GetComponent<Renderer>().bounds;
|
||||
upValue = objectBounds.size.y;
|
||||
}
|
||||
|
||||
Vector3 reticlePosition = new Vector3(transform.position.x, transform.position.y + objectBounds.size.y, transform.position.z);
|
||||
Vector3 reticlePosition = new Vector3(transform.position.x, transform.position.y + upValue, transform.position.z);
|
||||
|
||||
return reticlePosition;
|
||||
}
|
||||
|
||||
public void OnEnable(){
|
||||
Debug.Log("hewwo");
|
||||
}
|
||||
|
||||
public void SafelyDeleteTarget(){
|
||||
// gameObject.
|
||||
foreach (LockOnManager.ActiveLockOnTarget target in LockOnManager.Instance.activeTargets) {
|
||||
if (target.gameObject == this.gameObject) {
|
||||
GameObject clone = new GameObject{name = $"Target Clone of {gameObject.name}", transform = { position = transform.position}};
|
||||
Debug.Log("hii");
|
||||
|
||||
target.gameObject = clone;
|
||||
target.cinemachineTarget.Object = clone.transform;
|
||||
|
||||
LockOnManager.Instance.QueueTargetRemoval(clone, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerCamera : MonoBehaviour{
|
||||
|
||||
Reference in New Issue
Block a user