110 lines
3.4 KiB
HTML
110 lines
3.4 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="zh">
|
||
|
|
<head>
|
||
|
|
<meta charset="utf-8" />
|
||
|
|
<base href="../../../" />
|
||
|
|
<script src="page.js"></script>
|
||
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<h1>[name]</h1>
|
||
|
|
|
||
|
|
<p class="desc"> A solver for IK with <a href="https://sites.google.com/site/auraliusproject/ccd-algorithm"><em>CCD Algorithm</em></a>. <br /><br />
|
||
|
|
[name] solves Inverse Kinematics Problem with CCD Algorithm.
|
||
|
|
[name] is designed to work with [page:SkinnedMesh] loaded by [page:MMDLoader] but also can be used for generic [page:SkinnedMesh].
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h2>代码示例</h2>
|
||
|
|
|
||
|
|
<code>
|
||
|
|
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 );
|
||
|
|
|
||
|
|
}
|
||
|
|
</code>
|
||
|
|
|
||
|
|
<h2>例子</h2>
|
||
|
|
|
||
|
|
<p>
|
||
|
|
[example:webgl_loader_mmd]<br />
|
||
|
|
[example:webgl_loader_mmd_pose]<br />
|
||
|
|
[example:webgl_loader_mmd_audio]
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h2>Constructor</h2>
|
||
|
|
|
||
|
|
<h3>[name]( [param:SkinnedMesh mesh], [param:Array iks] )</h3>
|
||
|
|
<p>
|
||
|
|
[page:SkinnedMesh mesh] — [page:SkinnedMesh] for which [name] solves IK problem.<br />
|
||
|
|
[page:Array iks] — An array of [page: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.<br />
|
||
|
|
<ul>
|
||
|
|
<li>[page:Integer target] — Target bone.</li>
|
||
|
|
<li>[page:Integer effector] — Effector bone.</li>
|
||
|
|
<li>[page:Array links] — An array of [page: Object] specifying link bones.
|
||
|
|
<ul>
|
||
|
|
<li>[page:Integer index] — Link bone.</li>
|
||
|
|
<li>[page:Vector3 limitation] — (optional) Rotation axis. Default is undefined.</li>
|
||
|
|
<li>[page:Vector3 rotationMin] — (optional) Rotation minimum limit. Default is undefined.</li>
|
||
|
|
<li>[page:Vector3 rotationMax] — (optional) Rotation maximum limit. Default is undefined.</li>
|
||
|
|
<li>[page:Boolean enabled] — (optional) Default is true.</li>
|
||
|
|
</ul>
|
||
|
|
</li>
|
||
|
|
<li>[page:Integer iteration] — (optional) Iteration number of calculation. Smaller is faster but less precise. Default is 1.</li>
|
||
|
|
<li>[page:Number minAngle] — (optional) Minimum rotation angle in a step. Default is undefined.</li>
|
||
|
|
<li>[page:Number maxAngle] — (optional) Maximum rotation angle in a step. Default is undefined.</li>
|
||
|
|
</ul>
|
||
|
|
</p>
|
||
|
|
<p>
|
||
|
|
Creates a new [name].
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h2>Properties</h2>
|
||
|
|
|
||
|
|
<h3>[property:Array iks]</h3>
|
||
|
|
<p>An array of IK parameter passed to the constructor.</p>
|
||
|
|
|
||
|
|
<h3>[property:SkinnedMesh mesh]</h3>
|
||
|
|
<p>[page:SkinnedMesh] passed to the constructor.</p>
|
||
|
|
|
||
|
|
<h2>Methods</h2>
|
||
|
|
|
||
|
|
<h3>[method:CCDIKHelper createHelper]()</h3>
|
||
|
|
<p>
|
||
|
|
Return [page:CCDIKHelper]. You can visualize IK bones by adding the helper to scene.
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h3>[method:CCDIKSolver update]()</h3>
|
||
|
|
<p>
|
||
|
|
Update bones quaternion by solving CCD algorithm.
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h3>[method:CCDIKSolver updateOne]( [param:Object ikParam] )</h3>
|
||
|
|
<p>
|
||
|
|
Update an IK bone quaternion by solving CCD algorithm.
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h2>Source</h2>
|
||
|
|
|
||
|
|
<p>
|
||
|
|
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js examples/jsm/animation/CCDIKSolver.js]
|
||
|
|
</p>
|
||
|
|
</body>
|
||
|
|
</html>
|