Tweaks
This commit is contained in:
@@ -272,13 +272,13 @@ void AnimGraphExecutor::Update(AnimGraphInstanceData& data, float dt)
|
||||
if (animResult == nullptr)
|
||||
animResult = GetEmptyNodes();
|
||||
}
|
||||
Transform* nodesTransformations = animResult->Nodes.Get();
|
||||
|
||||
// Calculate the global poses for the skeleton nodes
|
||||
{
|
||||
ANIM_GRAPH_PROFILE_EVENT("Global Pose");
|
||||
|
||||
data.NodesPose.Resize(_skeletonNodesCount, false);
|
||||
Transform* nodesTransformations = animResult->Nodes.Get();
|
||||
|
||||
// Note: this assumes that nodes are sorted (parents first)
|
||||
for (int32 nodeIndex = 0; nodeIndex < _skeletonNodesCount; nodeIndex++)
|
||||
@@ -286,7 +286,7 @@ void AnimGraphExecutor::Update(AnimGraphInstanceData& data, float dt)
|
||||
const int32 parentIndex = skeleton.Nodes[nodeIndex].ParentIndex;
|
||||
if (parentIndex != -1)
|
||||
{
|
||||
nodesTransformations[nodeIndex] = nodesTransformations[parentIndex].LocalToWorld(nodesTransformations[nodeIndex]);
|
||||
nodesTransformations[parentIndex].LocalToWorld(nodesTransformations[nodeIndex], nodesTransformations[nodeIndex]);
|
||||
}
|
||||
nodesTransformations[nodeIndex].GetWorld(data.NodesPose[nodeIndex]);
|
||||
}
|
||||
|
||||
@@ -300,17 +300,6 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnimGraphInstanceData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="object">The object that represents the instance data source.</param>
|
||||
AnimGraphInstanceData(ScriptingObject* object)
|
||||
: Object(object)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1426,18 +1426,16 @@ Actor* Actor::Intersects(const Ray& ray, float& distance, Vector3& normal)
|
||||
void Actor::LookAt(const Vector3& worldPos)
|
||||
{
|
||||
const Quaternion orientation = LookingAt(worldPos);
|
||||
|
||||
SetOrientation(orientation);
|
||||
}
|
||||
|
||||
void Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
|
||||
{
|
||||
const Quaternion orientation = LookingAt(worldPos, worldUp);
|
||||
|
||||
SetOrientation(orientation);
|
||||
}
|
||||
|
||||
Quaternion Actor::LookingAt(const Vector3& worldPos)
|
||||
Quaternion Actor::LookingAt(const Vector3& worldPos) const
|
||||
{
|
||||
const Vector3 direction = worldPos - _transform.Translation;
|
||||
if (direction.LengthSquared() < ZeroTolerance)
|
||||
@@ -1464,7 +1462,7 @@ Quaternion Actor::LookingAt(const Vector3& worldPos)
|
||||
return orientation;
|
||||
}
|
||||
|
||||
Quaternion Actor::LookingAt(const Vector3& worldPos, const Vector3& worldUp)
|
||||
Quaternion Actor::LookingAt(const Vector3& worldPos, const Vector3& worldUp) const
|
||||
{
|
||||
const Vector3 direction = worldPos - _transform.Translation;
|
||||
if (direction.LengthSquared() < ZeroTolerance)
|
||||
|
||||
@@ -796,14 +796,14 @@ public:
|
||||
/// Gets rotation of the actor oriented towards the specified world position.
|
||||
/// </summary>
|
||||
/// <param name="worldPos">The world position to orient towards.</param>
|
||||
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos);
|
||||
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos) const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
|
||||
/// </summary>
|
||||
/// <param name="worldPos">The world position to orient towards.</param>
|
||||
/// <param name="worldUp">The up direction that Constrains y axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
|
||||
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp);
|
||||
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ AnimatedModel::AnimatedModel(const SpawnParams& params)
|
||||
, _counter(0)
|
||||
, _lastMinDstSqr(MAX_float)
|
||||
, _lastUpdateFrame(0)
|
||||
, GraphInstance(this)
|
||||
{
|
||||
GraphInstance.Object = this;
|
||||
_world = Matrix::Identity;
|
||||
UpdateBounds();
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
/// Performs the full animation update. The actual update will be performed during gameplay tick.
|
||||
/// </summary>
|
||||
API_FUNCTION() void UpdateAnimation();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called after animation gets updated (new skeleton pose).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user