Skip to content

Commit

Permalink
Using interpolate_x sdf value for animation playback speed
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-della-vedova committed Feb 20, 2020
1 parent 4989abb commit 76dbd45
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/rendering/SceneManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ rendering::VisualPtr SceneManager::CreateActor(Entity _id,
waypoints[pointTp] = point->Pose();
}
trajInfo.SetWaypoints(waypoints);
// Animations are offset by 1 because index 0 is taken by the mesh name
auto animation = _actor.AnimationByIndex(trajInfo.AnimIndex()-1);
trajInfo.Waypoints()->InterpolateX(animation->InterpolateX());
}
else
{
Expand Down Expand Up @@ -924,15 +927,15 @@ std::map<std::string, math::Matrix4d> SceneManager::ActorMeshAnimationAt(

if (followTraj)
{
double distance = traj.DistanceSoFar(_time);
if (distance < 0.1)
if (traj.Waypoints()->InterpolateX())
{
rawFrames = skel->Animation(animIndex)->PoseAt(timeSeconds, !noLoop);
double distance = traj.DistanceSoFar(_time);
rawFrames = skel->Animation(animIndex)->PoseAtX(distance,
skel->RootNode()->Name());
}
else
{
rawFrames = skel->Animation(animIndex)->PoseAtX(distance,
skel->RootNode()->Name());
rawFrames = skel->Animation(animIndex)->PoseAt(timeSeconds, !noLoop);
}
}
else
Expand Down

0 comments on commit 76dbd45

Please sign in to comment.