1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
@@ -16,6 +17,10 @@ namespace BITKit
|
||||
[SerializeField] private bool disabledPosition;
|
||||
|
||||
[SerializeField] private Vector3 positionWeight=Vector3.one;
|
||||
|
||||
[SerializeField] private bool debug;
|
||||
|
||||
[SerializeField,ReadOnly(HideLabel = true)] private string debugInfo;
|
||||
|
||||
private Vector3 currentPosition;
|
||||
private Quaternion currentRotation=Quaternion.identity;
|
||||
@@ -25,6 +30,8 @@ namespace BITKit
|
||||
|
||||
private Transform _transform;
|
||||
|
||||
private readonly StringBuilder reportBuilder = new();
|
||||
|
||||
public Vector3 Position
|
||||
{
|
||||
get => _transform.localPosition;
|
||||
@@ -36,9 +43,13 @@ namespace BITKit
|
||||
set => _transform.localRotation = value;
|
||||
}
|
||||
|
||||
public void AddPosition(Vector3 value)
|
||||
public void AddPosition(Vector3 value,string info=null)
|
||||
{
|
||||
currentPosition += value;
|
||||
if (debug)
|
||||
{
|
||||
reportBuilder.AppendLine($"{info}:{value}");
|
||||
}
|
||||
}
|
||||
|
||||
// public void AddEuler(Vector3 value)
|
||||
@@ -46,11 +57,16 @@ namespace BITKit
|
||||
// //currentEuler += value;
|
||||
// currentRotation *= Quaternion.Euler(value);
|
||||
// }
|
||||
public void AddRotation(Quaternion value)
|
||||
public void AddRotation(Quaternion value, string info = null)
|
||||
{
|
||||
currentRotation *= value;
|
||||
if (debug)
|
||||
{
|
||||
reportBuilder.AppendLine($"{info}:{value}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetGlobalPosition(Vector3 value)
|
||||
{
|
||||
globalPosition = value;
|
||||
@@ -103,6 +119,12 @@ namespace BITKit
|
||||
currentRotation = Quaternion.identity;
|
||||
|
||||
currentPosition = Vector3.zero;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
debugInfo = reportBuilder.ToString();
|
||||
reportBuilder.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user