You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/manual/animation/model-node-links.md
+44-10Lines changed: 44 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,16 +10,15 @@ The **model node link** component attaches an entity to a node of a skeleton on
10
10
11
11
For example, imagine you have two models: a knight, and a sword. The character has a sword swinging animation. You can use a model link node to place the sword in the knight's hand and attach it to the correct node in the knight skeleton, so the sword swings with the knight animation.
@@ -38,11 +37,11 @@ For example, imagine you have two models: a knight, and a sword. The character h
38
37
39
38
4. Select the model you want to link the entity to and click **OK**.
40
39
41
-
>[!Note]
42
-
>The entity you link to must have a model with a skeleton, even if the model isn't visible at runtime.
40
+
>[!Note]
41
+
>The entity you link to must have a model with a skeleton, even if the model isn't visible at runtime.
43
42
44
-
>[!Tip]
45
-
>If you don't specify a model, Stride links the entity to the model on the parent entity.
43
+
>[!Tip]
44
+
>If you don't specify a model, Stride links the entity to the model on the parent entity.
46
45
47
46
5. In **Node name**, select the node in the model you want to attach this entity to.
48
47
@@ -58,8 +57,43 @@ To add an offset to the linked entity, use the entity's [TransformComponent](xre
58
57
59
58

60
59
61
-
>[!Note]
62
-
>If you don't want to add an offset, make sure the values are all set to `0,0,0`.
60
+
> [!Note]
61
+
> If you don't want to add an offset, make sure the values are all set to `0,0,0`.
62
+
63
+
## Example script
64
+
65
+
This script demonstrates how to link one entity (such as a `SwordModel`) to a specific bone (`weapon_bone_R`) in another entity's skeleton hierarchy (in this case, the `mannequinModel`) using Stride's `ModelNodeLinkComponent`.
66
+
67
+
```csharp
68
+
publicclassBoneLink : StartupScript
69
+
{
70
+
// This example assumes you've created a project with the default Stride models
71
+
// "mannequinModel" and "SwordModel." Add them from the "Assets/Models" folder to your scene,
72
+
// and then attach this script to the "SwordModel" entity
73
+
74
+
ModelNodeLinkComponentboneLink;
75
+
76
+
publicoverridevoidStart()
77
+
{
78
+
// Initialize the script
79
+
// Here we locate the entity named "mannequinModel" by searching the root scene's entities
0 commit comments