x56115666

1.gif

如图 我是在程序修改改 bone的坐标 模拟追踪鼠标的效果
鼠标弹起时,骨骼应该回到原位,但是这会导致动画闪烁, 如果对这部分设置平滑呢

---

touchBone.x = status.touchBonePoint.x;
touchBone.y = status.touchBonePoint.y;
touchBone.updateWorldTransform();

这是鼠标放开时的我做的操作, sdk pixi-spine
您没有权限查看这个主题的附件。
x56115666
  • 帖子: 3

Mario

如果您不再将鼠标位置应用于骨骼位置,那么骨骼位置将重置为在当前动画或设置姿势中找到的位置。 如果我没记错的话,pixi-spine 会不断地将动画状态(以及任何动画)应用于骨骼,然后更新骨骼变换。 如果您希望骨骼保持在最后一个鼠标位置,您必须继续在骨骼上设置鼠标位置并更新世界变换,就像您在拖动鼠标光标时所做的那样。

If you no longer apply the mouse position to the bone position, then the bone position will be reset to the position found in the current animation or setup pose. If i remember correctly, pixi-spine will constantly apply the animation state (and with that any animations) to the skeleton, then update the bone transforms. If you want the bone to stay at the last mouse position, you have to keep setting the mouse position on the bone and update the world transforms as you do already when dragging the mouse cursor.
头像
Mario

Mario
  • 帖子: 3248

x56115666

I want the bones to return smoothly to that position, not instantly.
x56115666
  • 帖子: 3

Mario

That's not something the runtime can do, as it doesn't know about you modifying the bone manually based on the mouse position, nor does it know for how long you want to interpolate from the last mouse position to whatever position the bone would have just based on the animation/setup pose.

You'll have to implement this in your user code. When the mouse button/touch is lifted, store the last mouse/touch position. Then, for as long as you want to interpolate, get the current bone position as calculated by the animation/setup pose, interpolate between that and the last mouse/touch position, and finally set the interpolated position on the bone.
头像
Mario

Mario
  • 帖子: 3248

x56115666

Thanks,I solved this problem with lerf
x56115666
  • 帖子: 3


回到 中国Spine用户