返回介绍

手册

参考

示例

开发者参考

CCDIKSolver

发布于 2021-07-10 14:14:19 字数 3695 浏览 1891 评论 0 收藏 0

A solver for IK with CCD Algorithm.

CCDIKSolver solves Inverse Kinematics Problem with CCD Algorithm. CCDIKSolver is designed to work with SkinnedMesh loaded by MMDLoader but also can be used for generic SkinnedMesh.

代码示例

const ikSolver;
// Load MMD resources and instantiate CCDIKSolver
new MMDLoader().load(
  'models/mmd/miku.pmd',
  function ( mesh ) {
    ikSolver = new CCDIKSolver( mesh, mesh.geometry.iks );
    scene.add( mesh );
  }
);
function render() {
  animate(); // update bones
  if ( ikSolver !== undefined ) ikSolver.update();
  renderer.render( scene, camera );
}

例子

webgl_loader_mmd
webgl_loader_mmd_pose
webgl_loader_mmd_audio

Constructor

CCDIKSolver( mesh : SkinnedMesh, iks : Array )

meshSkinnedMesh for which CCDIKSolver solves IK problem.
iks — An array of Object specifying IK parameter. target, effector, and link-index are index integers in .skeleton.bones. The bones relation should be "links[ n ], links[ n - 1 ], ..., links[ 0 ], effector" in order from parent to child.

  • target — Target bone.
  • effector — Effector bone.
  • links — An array of [page: Object] specifying link bones.
    • index — Link bone.
    • limitation — (optional) Rotation axis. Default is undefined.
    • rotationMin — (optional) Rotation minimum limit. Default is undefined.
    • rotationMax — (optional) Rotation maximum limit. Default is undefined.
    • enabled — (optional) Default is true.
  • iteration — (optional) Iteration number of calculation. Smaller is faster but less precise. Default is 1.
  • minAngle — (optional) Minimum rotation angle in a step. Default is undefined.
  • maxAngle — (optional) Maximum rotation angle in a step. Default is undefined.

Creates a new CCDIKSolver.

Properties

.iks : Array

An array of IK parameter passed to the constructor.

.mesh : SkinnedMesh

SkinnedMesh passed to the constructor.

Methods

.createHelper () : CCDIKHelper

Return CCDIKHelper. You can visualize IK bones by adding the helper to scene.

.update () : CCDIKSolver

Update bones quaternion by solving CCD algorithm.

.updateOne ( ikParam : Object ) : CCDIKSolver

Update an IK bone quaternion by solving CCD algorithm.

Source

examples/jsm/animation/CCDIKSolver.js

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文