[page:Object3D] → [page:Mesh] →

[name]

شبكة لديها [page:Skeleton] مع [page:Bone bones] يمكن استخدامها بعد ذلك لتحريك رؤوس الهندسة.

مثال للكود

const geometry = new THREE.CylinderGeometry( 5, 5, 5, 5, 15, 5, 30 ); // create the skin indices and skin weights manually // (typically a loader would read this data from a 3D model for you) const position = geometry.attributes.position; const vertex = new THREE.Vector3(); const skinIndices = []; const skinWeights = []; for ( let i = 0; i < position.count; i ++ ) { vertex.fromBufferAttribute( position, i ); // compute skinIndex and skinWeight based on some configuration data const y = ( vertex.y + sizing.halfHeight ); const skinIndex = Math.floor( y / sizing.segmentHeight ); const skinWeight = ( y % sizing.segmentHeight ) / sizing.segmentHeight; skinIndices.push( skinIndex, skinIndex + 1, 0, 0 ); skinWeights.push( 1 - skinWeight, skinWeight, 0, 0 ); } geometry.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) ); geometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) ); // create skinned mesh and skeleton const mesh = new THREE.SkinnedMesh( geometry, material ); const skeleton = new THREE.Skeleton( bones ); // see example from THREE.Skeleton const rootBone = skeleton.bones[ 0 ]; mesh.add( rootBone ); // bind the skeleton to the mesh mesh.bind( skeleton ); // move the bones and manipulate the model skeleton.bones[ 0 ].rotation.x = -0.1; skeleton.bones[ 1 ].rotation.x = 0.2;

المنشئ (Constructor)

[name]( [param:BufferGeometry geometry], [param:Material material] )

[page:BufferGeometry geometry] - نسخة من [page:BufferGeometry].
[page:Material material] - (اختياري) نسخة من [page:Material]. الافتراضي هو [page:MeshBasicMaterial] جديد.

الخصائص (Properties)

انظر إلى الفئة الأساسية [page:Mesh] للحصول على الخصائص المشتركة.

[property:String bindMode]

Either `AttachedBindMode` or `DetachedBindMode`. `AttachedBindMode` means the skinned mesh shares the same world space as the skeleton. This is not true when using `DetachedBindMode` which is useful when sharing a skeleton across multiple skinned meshes. Default is `AttachedBindMode`.

[property:Matrix4 bindMatrix]

المصفوفة الأساسية المستخدمة لتحويلات العظام المربوطة.

[property:Matrix4 bindMatrixInverse]

المصفوفة الأساسية المستخدمة لإعادة تعيين تحويلات العظام المربوطة.

[property:Box3 boundingBox]

مربع التحديد لـ [name]. يمكن حسابه بـ [page:.computeBoundingBox](). الافتراضي هو `null`.

[property:Sphere boundingSphere]

الكرة المحيطة لـ [name]. يمكن حسابها بـ [page:.computeBoundingSphere](). الافتراضي هو `null`.

[property:Boolean isSkinnedMesh]

علامة للقراءة فقط للتحقق مما إذا كان كائن معين هو من نوع [name].

[property:Skeleton skeleton]

[page:Skeleton] يمثل هيكل العظام للشبكة المشدودة.

الطرق (Methods)

انظر إلى الفئة الأساسية [page:Mesh] للحصول على الطرق المشتركة.

[method:undefined bind]( [param:Skeleton skeleton], [param:Matrix4 bindMatrix] )

[page:Skeleton skeleton] - [page:Skeleton] تم إنشاؤه من شجرة [page:Bone Bones].
[page:Matrix4 bindMatrix] - [page:Matrix4] يمثل التحويل الأساسي للهيكل العظمي.

ربط هيكل عظمي بالشبكة المشدودة. يتم حفظ bindMatrix في خاصية .bindMatrix ويتم حساب .bindMatrixInverse.

[method:SkinnedMesh clone]()

لا تقوم هذه الطريقة حاليًا بنسخ نسخة من [name] بشكل صحيح. يرجى استخدام [page:SkeletonUtils.clone]() في هذه الأثناء.

[method:undefined computeBoundingBox]()

حساب مربع التحديد، وتحديث خاصية [page:.boundingBox].
لا يتم حساب مربعات التحديد افتراضيًا. يجب حسابها بشكل صريح ، وإلا كانت `null`. إذا كانت نسخة من [name] متحركة، يجب استدعاء هذه الطريقة في كل إطار لحساب مربع تحديد صحيح.

[method:undefined computeBoundingSphere]()

حساب الكرة المحيطة، وتحديث خاصية [page:.boundingSphere] .
لا يتم حساب الكرات المحيطة افتراضيًا. يجب حسابها بشكل صريح ، وإلا كانت `null`. إذا كانت نسخة من [name] متحركة، يجب استدعاء هذه الطريقة في كل إطار لحساب كرة محيطة صحيحة.

[method:undefined normalizeSkinWeights]()

تطبيع أوزان الجلد.

[method:undefined pose]()

هذه الطريقة تضع الشبكة المشدودة في وضعية الأساس (إعادة تعيين الوضعية).

[method:Vector3 applyBoneTransform]( [param:Integer index], [param:Vector3 vector] )

تطبق تحويل العظام المرتبط بالفهرس المعطى على موضع المتجه المعطى. يُعاد المتجه المُحدَّث.

المصدر (Source)

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]