Unity/TopdownEngine
무기 조준 각도 변경
lipnus
2023. 5. 11. 21:00
반응형
Weapon의 Transform만 변경시키고, Projectile에는 영향 없음
Weapon3DAim.cs
protected override void AimAt(Vector3 target)
{
base.AimAt(target);
_aimAtDirection = target - transform.position;
_aimAtQuaternion = Quaternion.LookRotation(_aimAtDirection, Vector3.up);
if (Howitzer > 0)
{
_aimAtQuaternion *= Quaternion.AngleAxis(-Howitzer, new Vector3(1,0,0));
}
if (WeaponRotationSpeed == 0f)
{
transform.rotation = _aimAtQuaternion;
}
else
{
transform.rotation = Quaternion.Lerp(transform.rotation, _aimAtQuaternion, WeaponRotationSpeed * Time.deltaTime);
}
}
반응형