rj-action-library/Runtime/VirtualCameras/ThirdPersonCameraTargetOffs...

39 lines
903 B
C#

using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class ThirdPersonCameraTargetOffset:CameraTargetOffset
{
[Export]
public ThirdPersonCamera thirdPersonCamera;
[Export]
public Curve pitchMultiply;
public override void SetMovingForward( float movingForward )
{
if ( pitchMultiply != null && thirdPersonCamera != null )
{
var normalizedPitch = thirdPersonCamera.normalizedPitch;
var sampledPitchMultiply = pitchMultiply.Sample( normalizedPitch );
movingForward *= sampledPitchMultiply;
}
nextZ = Mathf.Lerp( cameraTargetMinOffsetZ, cameraTargetMaxOffsetZ, movingForward );
nextY = Mathf.Lerp( cameraTargetMinOffsetY, cameraTargetMaxOffsetY, movingForward );
}
}
}