large worlds engine compat refactor, change vector -> float
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Game
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
Vector3 initialEulerAngles = Actor.Orientation.EulerAngles;
|
||||
Float3 initialEulerAngles = Actor.Orientation.EulerAngles;
|
||||
viewPitch = initialEulerAngles.X;
|
||||
viewYaw = initialEulerAngles.Y;
|
||||
viewRoll = initialEulerAngles.Z;
|
||||
@@ -62,7 +62,7 @@ namespace Game
|
||||
|
||||
float inputH = InputManager.GetAxis("Horizontal");
|
||||
float inputV = InputManager.GetAxis("Vertical");
|
||||
Vector3 move = new Vector3(inputH, 0.0f, inputV);
|
||||
Float3 move = new Float3(inputH, 0.0f, inputV);
|
||||
|
||||
if (!move.IsZero)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ namespace Game
|
||||
move = camera.Transform.TransformDirection(move) * MoveSpeed;
|
||||
|
||||
{
|
||||
Vector3 delta = move * Time.UnscaledDeltaTime;
|
||||
Float3 delta = move * Time.UnscaledDeltaTime;
|
||||
float movementLeft = delta.Length;
|
||||
|
||||
// TODO: check multiple times in case we get stuck in walls
|
||||
@@ -83,7 +83,7 @@ namespace Game
|
||||
|
||||
//bool nohit = true;
|
||||
float hitDistance = moveDist;
|
||||
Vector3 hitNormal = move.Normalized;
|
||||
Float3 hitNormal = move.Normalized;
|
||||
foreach (RayCastHit hitInfo in hitInfos)
|
||||
{
|
||||
if (hitInfo.Collider.Parent == Parent)
|
||||
@@ -99,7 +99,7 @@ namespace Game
|
||||
}
|
||||
|
||||
if (hitDistance != moveDist)
|
||||
//camTrans.Translation = Vector3.Lerp(Actor.Transform.Translation, camTrans.Translation, hitDistance);
|
||||
//camTrans.Translation = Float3.Lerp(Actor.Transform.Translation, camTrans.Translation, hitDistance);
|
||||
|
||||
//projected = normal * dot(direction, normal);
|
||||
//direction = direction - projected
|
||||
@@ -107,7 +107,7 @@ namespace Game
|
||||
//camTrans.Translation += hitNormal * (moveDist - hitDistance); // correct?
|
||||
//camTrans.Translation = hitNormal * (move * hitNormal); // correct?
|
||||
//camTrans.Translation = Actor.Transform.Translation;
|
||||
delta += -Vector3.Dot(delta, hitNormal) * hitNormal; // correct?
|
||||
delta += -Float3.Dot(delta, hitNormal) * hitNormal; // correct?
|
||||
|
||||
camTrans.Translation += delta;
|
||||
}
|
||||
|
||||
@@ -141,9 +141,9 @@ namespace Game
|
||||
{
|
||||
lastRescale = rescaleModel;
|
||||
if (rescaleModel)
|
||||
viewModelHolder.Scale = new Vector3(0.75f);
|
||||
viewModelHolder.Scale = new Float3(0.75f);
|
||||
else
|
||||
viewModelHolder.Scale = new Vector3(1.0f);
|
||||
viewModelHolder.Scale = new Float3(1.0f);
|
||||
}
|
||||
|
||||
if (!camera.IsActive)
|
||||
|
||||
@@ -5,14 +5,14 @@ namespace Game
|
||||
public class CameraSpring : Script
|
||||
{
|
||||
private bool lastGround;
|
||||
private Vector3 lastPosition;
|
||||
private Float3 lastPosition;
|
||||
public float percY;
|
||||
|
||||
private Actor playerActor;
|
||||
private PlayerMovement playerMovement;
|
||||
|
||||
public float speed = 240f;
|
||||
private Vector3 targetOffset;
|
||||
private Float3 targetOffset;
|
||||
private Actor viewModelHolder;
|
||||
|
||||
public override void OnStart()
|
||||
@@ -25,7 +25,7 @@ namespace Game
|
||||
targetOffset = Actor.LocalPosition;
|
||||
}
|
||||
|
||||
private void UpdatePosition(Vector3 position)
|
||||
private void UpdatePosition(Float3 position)
|
||||
{
|
||||
Actor.Position = position;
|
||||
viewModelHolder.Position = position;
|
||||
@@ -33,8 +33,8 @@ namespace Game
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
Vector3 position = Actor.Parent.Position + targetOffset;
|
||||
Vector3 targetPosition = position;
|
||||
Float3 position = Actor.Parent.Position + targetOffset;
|
||||
Float3 targetPosition = position;
|
||||
|
||||
if (playerMovement.onGround)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace Game
|
||||
{
|
||||
Quaternion rotation = GetRotation();
|
||||
|
||||
Vector3 targetAngles = rotation.EulerAngles;
|
||||
Vector3 angles = Actor.LocalOrientation.EulerAngles;
|
||||
Float3 targetAngles = rotation.EulerAngles;
|
||||
Float3 angles = Actor.LocalOrientation.EulerAngles;
|
||||
|
||||
// Ensure the swaying is smooth when framerate fluctuates slightly
|
||||
float remaining = Time.DeltaTime + timeRemainder;
|
||||
|
||||
Reference in New Issue
Block a user