Added tree grwoth camera animation, fixed combat camera state, fixed many errors in the console

This commit is contained in:
2024-12-28 10:28:50 +01:00
parent e75b093317
commit f59a127a4e
10 changed files with 872 additions and 831 deletions

View File

@@ -27,7 +27,10 @@ namespace Invector.vCharacterController
[vEditorToolbar("Debug", order = 9)]
[HideInInspector]
public bool debugActionListener;
public Animator animator { get; protected set; }
public Animator animator
{ get;
protected set;
}
public bool ragdolled { get; set; }
[vEditorToolbar("Events")]

View File

@@ -85,7 +85,9 @@ namespace Invector
if (transform == null) return false;
var animator = transform.GetComponent<Animator>();
if (animator == null) return false;
var leftFoot = animator.GetBoneTransform(HumanBodyBones.LeftFoot);
Transform leftFoot = null;
if (animator.isHuman)
leftFoot = animator.GetBoneTransform(HumanBodyBones.LeftFoot);
vFootStepTrigger leftFoot_trigger = null;
if (leftFoot != null)
leftFoot_trigger = leftFoot.GetComponentInChildren<vFootStepTrigger>();
@@ -112,7 +114,9 @@ namespace Invector
collider.radius = 0.1f;
}
var rightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot);
Transform rightFoot = null;
if (animator.isHuman)
rightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot);
vFootStepTrigger rightFoot_trigger = null;
if (rightFoot != null)
rightFoot_trigger = rightFoot.GetComponentInChildren<vFootStepTrigger>();

View File

@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -262,15 +263,21 @@ namespace Invector.vCharacterController.AI
protected override void OnAnimatorMove()
{
if (Time.deltaTime == 0) return;
if (!customAction && useNavMeshAgent && navMeshAgent && navMeshAgent.enabled)
{
navMeshAgent.velocity = ((animator.deltaPosition) / Time.deltaTime) * Mathf.Clamp(remainingDistanceWithoutAgent - stopingDistance, 0, 1f);
//navMeshAgent.speed = Mathf.Clamp((float)System.Math.Round((double)(animator.deltaPosition / Time.deltaTime).magnitude , 2), 0.5f, maxSpeed);
navMeshAgent.speed = Mathf.Lerp(navMeshAgent.speed, maxSpeed, aceleration * Time.deltaTime);
navMeshAgent.nextPosition = animator.rootPosition;
try {
if (Time.deltaTime == 0 || animator == null) return;
if (!customAction && useNavMeshAgent && navMeshAgent && navMeshAgent.enabled)
{
navMeshAgent.velocity = ((animator.deltaPosition) / Time.deltaTime) * Mathf.Clamp(remainingDistanceWithoutAgent - stopingDistance, 0, 1f);
//navMeshAgent.speed = Mathf.Clamp((float)System.Math.Round((double)(animator.deltaPosition / Time.deltaTime).magnitude , 2), 0.5f, maxSpeed);
navMeshAgent.speed = Mathf.Lerp(navMeshAgent.speed, maxSpeed, aceleration * Time.deltaTime);
navMeshAgent.nextPosition = animator.rootPosition;
}
}
catch (Exception e)
{
Debug.LogException(e, this);
}
base.OnAnimatorMove();
}
@@ -317,7 +324,7 @@ namespace Invector.vCharacterController.AI
_currentWaypoint = GetNearPointIndex();
else if (_randomWaypoint)
_currentWaypoint = Random.Range(0, waypoints.Count);
_currentWaypoint = UnityEngine.Random.Range(0, waypoints.Count);
else _currentWaypoint = 0;
}
@@ -325,7 +332,7 @@ namespace Invector.vCharacterController.AI
if (isWaypointStarted)
{
if (_randomWaypoint)
_currentWaypoint = Random.Range(0, waypoints.Count);
_currentWaypoint = UnityEngine.Random.Range(0, waypoints.Count);
else
_currentWaypoint++;
@@ -1066,7 +1073,7 @@ namespace Invector.vCharacterController.AI
{
var waypoints = value.GetValidPoints();
if (_randomStartingPoint)
_currentWaypoint = Random.Range(0, waypoints.Count);
_currentWaypoint = UnityEngine.Random.Range(0, waypoints.Count);
}
_waypointArea = value;
}