Difference between revisions of "My first: Item - Interactable animated items"

From Divinity Engine Wiki
Jump to: navigation, search
(Created page with "Interactable animated items are more complicated assets. These are usually used for doors, levers, buttons and any other object that needs to be interacted with. These assets...")
 
Line 1: Line 1:
 
Interactable animated items are more complicated assets. These are usually used for doors, levers, buttons and any other object that needs to be interacted with. These assets exist out of 3D mesh(es), physics mesh and animations.<br />
 
Interactable animated items are more complicated assets. These are usually used for doors, levers, buttons and any other object that needs to be interacted with. These assets exist out of 3D mesh(es), physics mesh and animations.<br />
 
This guide will explain how we export these assets from 3DS Max and import them in the editor.
 
This guide will explain how we export these assets from 3DS Max and import them in the editor.
 +
 
<br />
 
<br />
 +
This article is part of a collection of guides, with a page for every type of item.
 +
 +
{| class="wikitable"
 +
|-
 +
| [[My first: Item | General]]
 +
|-
 +
| [[My first: Item - Scenery | Scenery]] (Rocks, plants, trees, shelves, etc.)
 +
|-
 +
| [[My first: Item - Lootable items | Lootable items]] (Shells, plates, food, gems, etc.)
 +
|-
 +
| [[My first: Item - Interactable animated items | Interactable animated items]] (Levers, doors, etc.)
 +
|-
 +
| [[My first: Item - Interactable socket items | Interactable socket items]] (Chairs, beds, etc.)
 +
|-
 +
| [[My first: Item - Weapons | Weapons]] (The sharp stuff)
 +
|-
 +
|}
 +
 
<br />
 
<br />
<big>''' Setup '''</big>
+
= Setup =
<br />
+
== Bones ==
<br />'''Bones'''
+
 
<br />
 
<br />
 
 
You can use either dummies or actual bones in 3DS Max to animate visuals. Make sure however that these bones are linked to a dummy which should be named either '''Dummy_Root''' or '''Dummy_<LayerName>'''.<br />  
 
You can use either dummies or actual bones in 3DS Max to animate visuals. Make sure however that these bones are linked to a dummy which should be named either '''Dummy_Root''' or '''Dummy_<LayerName>'''.<br />  
 
If you are using a single bone for one mesh make sure to select that mesh and click the '''MakeAnim''' button.<br />  
 
If you are using a single bone for one mesh make sure to select that mesh and click the '''MakeAnim''' button.<br />  
Line 14: Line 31:
 
<br />
 
<br />
 
Any mesh that needs no animation (example: a door trim) does not need to be linked to a bone or be skinned. It does require it to be linked to the '''Dummy_Root'''.
 
Any mesh that needs no animation (example: a door trim) does not need to be linked to a bone or be skinned. It does require it to be linked to the '''Dummy_Root'''.
 +
 
<br />
 
<br />
<br />
+
== Skinning ==
'''Skinning'''
+
 
<br />
 
<br />
 
 
Most of these objects are simple animations and only require one bone. In this case you could '''link''' your mesh to a '''Dummy_bone'''. <br />
 
Most of these objects are simple animations and only require one bone. In this case you could '''link''' your mesh to a '''Dummy_bone'''. <br />
 
<br />
 
<br />
 
If you want to use multiple bones start by selecting the mesh you want to be animated, open the modifier list and select skin.<br />
 
If you want to use multiple bones start by selecting the mesh you want to be animated, open the modifier list and select skin.<br />
 
Add the bone(s) you want to use. Apply weight paint if needed.<br />
 
Add the bone(s) you want to use. Apply weight paint if needed.<br />
 +
 
<br />
 
<br />
<br />
+
== Layer ==
'''Layer'''
 
 
<br />
 
<br />
 
<br />
 
<br />
Line 35: Line 51:
 
<br />
 
<br />
 
Even though it is not always needed, it would be best to follow the Larian naming conventions.<br />
 
Even though it is not always needed, it would be best to follow the Larian naming conventions.<br />
 +
 
<br />
 
<br />
<br />
+
== Physics ==
'''Physics'''
+
<br />
 
<br />
 
 
Create your physics mesh and name it properly. Now you will need to link your physics mesh to your animated mesh. We do this by using a proxy so the physics mesh can be animated.<br />  
 
Create your physics mesh and name it properly. Now you will need to link your physics mesh to your animated mesh. We do this by using a proxy so the physics mesh can be animated.<br />  
 
First use the 3DS Max link tool to link your physics mesh to your 3D Mesh. Once you have done this right click on your animated mesh, select '''Object Properties''', go to '''User Defined''' tab and insert the following lines:
 
First use the 3DS Max link tool to link your physics mesh to your 3D Mesh. Once you have done this right click on your animated mesh, select '''Object Properties''', go to '''User Defined''' tab and insert the following lines:
Line 60: Line 75:
 
<br />
 
<br />
 
[[File:Door_Setup.png|none]]
 
[[File:Door_Setup.png|none]]
 +
 
<br />
 
<br />
<br />
+
= Exporting =
<big>''' Exporting '''</big>
+
== Animation Manager ==
<br />
+
 
<br />'''Animation Manager'''
 
<br />
 
<br />
 
 
After you have created and tested your animation you’ll need add your animation to the animation manager.<br />  
 
After you have created and tested your animation you’ll need add your animation to the animation manager.<br />  
 
In the animation manager you can add multiple animations by first selecting the '''Dummy_Root''' at the top.<br />  
 
In the animation manager you can add multiple animations by first selecting the '''Dummy_Root''' at the top.<br />  
Line 76: Line 89:
 
<br />
 
<br />
 
[[File:Animation_Manager.png|none]]
 
[[File:Animation_Manager.png|none]]
 +
 
<br />
 
<br />
<br />
+
== Exporting ==
'''Exporting'''
+
 
<br />
 
<br />
 
 
Exporting the visual is straight forward. Make sure your mesh and physics mesh are in the same layer. Make sure everything is linked to the '''Dummy_Root'''.<br />  
 
Exporting the visual is straight forward. Make sure your mesh and physics mesh are in the same layer. Make sure everything is linked to the '''Dummy_Root'''.<br />  
 
You do '''not''' have to export anything other then the visuals and physics.<br />
 
You do '''not''' have to export anything other then the visuals and physics.<br />
Line 91: Line 103:
 
<br />
 
<br />
 
<br />
 
<br />
<big>''' Importing '''</big>
+
= Importing =
<br />
+
== Importing your visuals ==
<br />
 
'''Importing your visuals'''
 
 
<br />
 
<br />
 
<br />
 
<br />
Line 100: Line 110:
 
Once selected add the resource by pressing the '''Add Resource''' button. Now you can choose to add your model or physics.<br />
 
Once selected add the resource by pressing the '''Add Resource''' button. Now you can choose to add your model or physics.<br />
 
Once you added your files you can now find it in your content browser either by selecting the proper package and finding it or using the search bar at the top.
 
Once you added your files you can now find it in your content browser either by selecting the proper package and finding it or using the search bar at the top.
 +
 
<br />
 
<br />
<br />
+
= Importing your animation =
<br />
+
 
'''Importing your animation'''
 
<br />
 
<br />
 
 
After adding your visual it is now time to import your animation. This process is similar to importing your visual.<br />
 
After adding your visual it is now time to import your animation. This process is similar to importing your visual.<br />
 
Start by opening your '''Content Browser''', now select the proper package you want to add your visual to.<br />
 
Start by opening your '''Content Browser''', now select the proper package you want to add your visual to.<br />
 
Once selected add the resource by pressing the '''Add Resource''' button. Now you can choose to add your animation.
 
Once selected add the resource by pressing the '''Add Resource''' button. Now you can choose to add your animation.
 +
 
<br />
 
<br />
<br />
+
= Adding resources =
<br />
+
 
'''Adding resources'''
 
<br />
 
<br />
 
 
After importing all you resources it is time to add all of them together. To start, open your '''Content Browser'''.<br />
 
After importing all you resources it is time to add all of them together. To start, open your '''Content Browser'''.<br />
 
Find your visual, double click it and a new window will open. You will start on the '''Materials''' tab, here you will see each of your meshes inside the exported visual.<br />
 
Find your visual, double click it and a new window will open. You will start on the '''Materials''' tab, here you will see each of your meshes inside the exported visual.<br />
Line 132: Line 138:
 
* Half_Open
 
* Half_Open
 
* Lever
 
* Lever
 +
 
<br />
 
<br />
'''Creating a root template'''
+
== Creating a root template ==
<br />
+
 
<br />
 
 
With all your resources imported and setup properly we can now add it all to a root template. The template is what you will actually use to place all of your combined visuals.<br />
 
With all your resources imported and setup properly we can now add it all to a root template. The template is what you will actually use to place all of your combined visuals.<br />
 
To make things easy whenever you want to create your template find something similar in the '''Root Template''' browser, right click it and select '''create new from selected'''.<br />
 
To make things easy whenever you want to create your template find something similar in the '''Root Template''' browser, right click it and select '''create new from selected'''.<br />
Line 143: Line 149:
 
First select the resource in your '''Content Browser''', now select the resource slot in the '''createObjectWizard'''. A '''...''' button should appear on the right.<br />
 
First select the resource in your '''Content Browser''', now select the resource slot in the '''createObjectWizard'''. A '''...''' button should appear on the right.<br />
 
Now simply press the '''green arrow''' button and you are done. You might have noticed the naming of the template changed automatically to the name of the visual resource. You are allowed to change this if you want.
 
Now simply press the '''green arrow''' button and you are done. You might have noticed the naming of the template changed automatically to the name of the visual resource. You are allowed to change this if you want.
 +
 +
<br />
 +
= See also =
 +
 +
{| class="wikitable"
 +
|-
 +
| [[My first: Item | General]]
 +
|-
 +
| [[My first: Item - Scenery | Scenery]] (Rocks, plants, trees, shelves, etc.)
 +
|-
 +
| [[My first: Item - Lootable items | Lootable items]] (Shells, plates, food, gems, etc.)
 +
|-
 +
| [[My first: Item - Interactable animated items | Interactable animated items]] (Levers, doors, etc.)
 +
|-
 +
| [[My first: Item - Interactable socket items | Interactable socket items]] (Chairs, beds, etc.)
 +
|-
 +
| [[My first: Item - Weapons | Weapons]] (The sharp stuff)
 +
|-
 +
|}

Revision as of 14:44, 28 September 2017

Interactable animated items are more complicated assets. These are usually used for doors, levers, buttons and any other object that needs to be interacted with. These assets exist out of 3D mesh(es), physics mesh and animations.
This guide will explain how we export these assets from 3DS Max and import them in the editor.


This article is part of a collection of guides, with a page for every type of item.

General
Scenery (Rocks, plants, trees, shelves, etc.)
Lootable items (Shells, plates, food, gems, etc.)
Interactable animated items (Levers, doors, etc.)
Interactable socket items (Chairs, beds, etc.)
Weapons (The sharp stuff)


Setup

Bones

You can use either dummies or actual bones in 3DS Max to animate visuals. Make sure however that these bones are linked to a dummy which should be named either Dummy_Root or Dummy_<LayerName>.
If you are using a single bone for one mesh make sure to select that mesh and click the MakeAnim button.
This can also be done by hand by selecting the mesh, right clicking on it, select Object Properties, go to User Defined tab and type Rigid = true.
This does not need to be done when you are using multiple bones in the skinning.

Any mesh that needs no animation (example: a door trim) does not need to be linked to a bone or be skinned. It does require it to be linked to the Dummy_Root.


Skinning

Most of these objects are simple animations and only require one bone. In this case you could link your mesh to a Dummy_bone.

If you want to use multiple bones start by selecting the mesh you want to be animated, open the modifier list and select skin.
Add the bone(s) you want to use. Apply weight paint if needed.


Layer



The name of your layer will be the name of your visual, so pick something logical. Inside this layer you could/should only have the following:

  • Your mesh(es), which is named <LayerName> or with multiple meshes <LayerName_(any addition that seems fit)>
  • Your physics mesh (if needed), which is named <LayerName>_phys
  • A root dummy which is named Dummy_<LayerName>


Even though it is not always needed, it would be best to follow the Larian naming conventions.


Physics

Create your physics mesh and name it properly. Now you will need to link your physics mesh to your animated mesh. We do this by using a proxy so the physics mesh can be animated.
First use the 3DS Max link tool to link your physics mesh to your 3D Mesh. Once you have done this right click on your animated mesh, select Object Properties, go to User Defined tab and insert the following lines:

Rigid = true
LarianPhysics_Type = proxy
Proxy_Geometry = <LayerName>_phys

Now right click on your physics mesh, select Object Properties, go to User Defined tab and insert the following lines:

LarianPhysics_Type = rigid_body
LarianPhysics_RigidBody_Type = static
LarianPhysics_RigidBody_Mass = 0.0
LarianPhysics_RigidBody_Friction = 1.0
LarianPhysics_RigidBody_Restitution = 0.0
LarianPhysics_Shape_Type = convex
LarianPhysics_Shape_Flags = 0

An example of a properly setup file:

Door Setup.png


Exporting

Animation Manager

After you have created and tested your animation you’ll need add your animation to the animation manager.
In the animation manager you can add multiple animations by first selecting the Dummy_Root at the top.
Now you can create a new layer by clicking “new” in the bottom left corner.
You will need to enter a name, the begin and end frame number of your animation. Each separate animation needs it own layer.
The name of you animation layer needs to be <LayerName>_<AnimationName>_Anim

Example:

Animation Manager.png


Exporting

Exporting the visual is straight forward. Make sure your mesh and physics mesh are in the same layer. Make sure everything is linked to the Dummy_Root.
You do not have to export anything other then the visuals and physics.

After exporting the visuals you will need to export the animation. Start of by saving the 3DS max file again in a separate folder located in the same folder.
This folder needs to be named <LayerName>_<AnimationName>, in here you will save your 3DS Max file as <LayerName>_<AnimationName>_Anim.
If this is done correctly you will now be able to select the animation layers you want to export.

Folder Setup.png



Importing

Importing your visuals



Importing your visual and physics is the same as any other item. Start by opening your Content Browser, now select the proper package you want to add your visual to.
Once selected add the resource by pressing the Add Resource button. Now you can choose to add your model or physics.
Once you added your files you can now find it in your content browser either by selecting the proper package and finding it or using the search bar at the top.


Importing your animation

After adding your visual it is now time to import your animation. This process is similar to importing your visual.
Start by opening your Content Browser, now select the proper package you want to add your visual to.
Once selected add the resource by pressing the Add Resource button. Now you can choose to add your animation.


Adding resources

After importing all you resources it is time to add all of them together. To start, open your Content Browser.
Find your visual, double click it and a new window will open. You will start on the Materials tab, here you will see each of your meshes inside the exported visual.
Select the mesh you want to add the texture to, now find and select your texture in the Content Browser. Now you can add your texture by clicking the <- button.

Now you can move on to the Default Animations tab, here you can add your animations. In the top right corner click on the drop down menu and select item. You should see a "list" appear with some animation slots.
For doors we will use the open and close slots. Start by selecting the animation slot you want to add your animation to, find and select your animation in the Content Browser. Now you can add your animation by clicking the <- button.

IMPORTANT

When creating levers, adding animations is a little different. Instead of using the Default tab in Default Animations you will need to use the Custom tab.
Here you will have to add the custom animations by selecting the the white square under Anim Name and typing the following (these are case sensitive and hard coded so double check):

  • Full_Open
  • Close_01
  • Half_Open_To_Full_Open
  • Half_Open
  • Lever


Creating a root template

With all your resources imported and setup properly we can now add it all to a root template. The template is what you will actually use to place all of your combined visuals.
To make things easy whenever you want to create your template find something similar in the Root Template browser, right click it and select create new from selected.
This will prevent any extra work in the form of scripting, naming or checking any of the important features.

Once you create new from selected a new window will open called createObjectWizard here you can add the new Physics Resource ID and Visual Resource ID.
First select the resource in your Content Browser, now select the resource slot in the createObjectWizard. A ... button should appear on the right.
Now simply press the green arrow button and you are done. You might have noticed the naming of the template changed automatically to the name of the visual resource. You are allowed to change this if you want.


See also

General
Scenery (Rocks, plants, trees, shelves, etc.)
Lootable items (Shells, plates, food, gems, etc.)
Interactable animated items (Levers, doors, etc.)
Interactable socket items (Chairs, beds, etc.)
Weapons (The sharp stuff)