Endorphin:Руководство 6 - Создание персонажам опорных объектов

Материал из Tiarum
Перейти к: навигация, поиск
Руководство 6 - Создание персонажам опорных объектов
45px-Scroll.png
ориг.название: Tutorial 6. Creating prop characters
вики-редакция: Garin
ссылка на сайт: NaturalMotion
обсудить на форуме: Обсудить на форуме
версия оригинала: 1.0
версия вики: 1.0
Переводить Этот материал нуждается в переводе или допереводе..
Вы можете помочь перевести его. Не забывайте предварительно добавлять строку {{Edit|--~~~~}} в материалы над которыми работаете, чтобы не создавать конфликта правок.
Пожалуйста, снимите шаблон этого сообщения, когда материал будет вычитан.


Endorphin: Руководство 6 - Создание персонажам опорных объектов


Содержание

Предисловие

In this tutorial, you are going to create more complex scene objects using collections of mass objects and collision objects saved as three separate prop characters.

You are then going to add instances of these prop characters to the scene that you made in Tutorial 4 – Creating Environments. You do not need to have worked through Tutorial 4, however, as the final scene from that tutorial has been copied as the initial setup scene for this tutorial.

Before you begin

Before we begin this tutorial, it is important to understand some key concepts associated with endorphin environments and prop characters.

Environment objects


In Tutorial 4, you created a complicated environment by adding collision objects to the Environment character. Adding collision objects directly to the environment is a quick way to create static, rigid structures in your scene.

You also added some mass objects to the environment, and attached collision objects to these mass objects. Adding mass objects to the environment is a good way to create dynamic environment entities—such as pieces of furniture—that are mobile and not directly attached to the world. These dynamic objects can gain velocity and momentum as a result of forces and collisions.

Prop characters


In this tutorial, you will use Character Edit Mode to create new prop characters.

Prop characters are collections of joints, mass objects and collision objects that represent scene objects. A prop character might be a simple object such as a piece of furniture, or a complex articulated object, such as a vehicle. A prop character can even represent an animal, such as a horse. Prop characters are stored in endorphin .nmc character files.

One advantage of creating prop characters is that you can add them to multiple scenes. Another advantage is that you can import animation onto prop characters, which allows you to create much more complex settings for your simulation characters. For example, you might create a horse prop character, add it to a scene, and then import a gallop animation cycle onto the horse. You could then place a simulation character on the horse and simulate the scene. During the simulation, the galloping motion will transmit forces to the simulation character.

Adding timeline events to prop characters


You can apply any type of event—other than behaviour events—to prop characters. Not only can you apply forces, constraints and sever events to a prop character, you can also apply active poses. You can even use active animation events and motion transfer events to reuse animation data in a dynamic context.

You cannot use behaviour events on prop characters. This is because the endorphin Behaviour Library has been specifically designed for use with bipedal humanoid characters derived from the endorphin standard simulation character.

Step 1: Building a chair

In this step we will build a new prop character that represents a chair. It will be composed of a single joint and a single mass object, with several collision objects used to fill out its shape.

To create a new prop character:


  • Launch endorphin, and select File > New Character….
  • Select the Standard Prop Character from the Standard Characters list, and click OK.
The Standard Prop Character contains a single joint and single mass object, and is useful for solid prop objects. You cannot create additional joints or mass objects in Character Edit Mode. To create more complex, articulated characters, you need to create them by importing a skeleton contained in an FBX, BVH, XSI, ASF or Vicon VSK file. You will create a prop character using this approach in the next step.

Endo Tut06 ITE 01.jpg

  • You have now created a new prop character. This character is based on the Standard Prop Character and appears as a single spherical mass object. There is no corresponding simulation character, and so the reference character is permanently active when you are editing prop characters. Note that prop characters are considered to be a type of reference character, as they are created to represent equivalent objects in your source animation scenes. Prop characters are saved with a _ref.nmc file extension.
  • Display the Node View to examine the structure of this character. You will note that the prop character has a single root joint, a single rootMass mass object and a single RootCollision collision object. You cannot delete this joint or mass object. However, you can add and remove collision objects.

To add a graphical object representing the prop shape:


  • Delete the RootCollision collision object.
  • Select the rootMass mass object.
  • Select File > Import and browse to select Resources\Tutorials\Tutorial 6 – Creating Props\HallChair.obj. Do not modify any of the default import options. Click OK. This imports the OBJ mesh and creates a corresponding graphical object as a child of the selected mass object. This graphical object represents the outer surface of the chair that you are going to fill out using collision objects.
Before creating any new collision objects, the first step is to ensure that the mass object is placed at the centre of mass of the chair. When you are building props, you do not need a mass object for each collision object. The equivalent dynamic properties of the compound object can be approximated by a single mass object, provided that it is located at the centre of mass of the entire object, and has a mass equivalent to the mass of the entire object.
  • Activate the Move tool.
  • Select the graphical object, and move it until the mass object is located roughly at the centre of mass of the chair.

6. Select the mass object, and move it vertically so that the chair legs of the graphical mesh make contact with the floor. Keep in mind that when you move the mass object, the graphical object also moves. This is because the graphical object was created as a child of the mass object.

Endo Tut06 ITE 02.jpg

To fill out the prop with collision objects:


You can now start adding collision objects to fill out the chair shape represented by the graphical object. Before you can create a collision object, you must first select the mass object that will become the parent of the new collision object.

  • Select the rootMass mass object.
  • Click the Create Box Collision Object button on the Main Toolbar. This creates a new box collision object.
  • Use the Move, Rotate and Scale tools to adjust the size and position of this collision object until it coincides with the chair seat.

Endo Tut06 ITE 03.jpg

  • Add more collision objects using the same approach. Remember that each time you create a new collision object, the parent mass object must be preselected. After you have created each new collision object, use the Move, Rotate and Scale tools to adjust the size and position the object until it coincides with its corresponding feature of the graphical object.
  • When you have finished modeling the chair, select File > Save Character. In the Save Character dialog, name the prop character Chair and click OK.

How many collision objects should I add?


Choosing how many collision objects to add depends on the type of prop and its intended use. You can usually ignore small features if they are unlikely to affect the way the prop interacts dynamically with other objects. Each additional collision object will slightly affect the simulation rate, so it is good practice to attempt to fill out props using the minimum number of collision objects.

If you are modeling a shape with a complex surface, and there is going to be a lot of contact with this surface during the simulation, then you may need to create many more collision objects to accurately reflect this shape; otherwise your resulting animation may contain object penetration.

These guidelines also apply when you are creating simulation characters derived from the standard simulation character.

Step 2: Creating a collapsible table

In this step we will build a new prop character that represents a table. Unlike the chair, the table will be made up of multiple joints and mass objects. This approach allows you to create the effect of breaking objects during a simulation. This technique was first introduced in Tutorial 4 – Creating Environments.

To create a table prop character using an imported character:


  • Select File > New Character….
  • In the New Character dialog, turn off the Create Character Using setting, and turn on the Create Reference Character Using setting.
You are going to create a new prop character using a character imported from an FBX animation file, rather than using the Standard Prop Character as the basis of the prop character. This approach is required when you want to create prop characters with more than one joint or mass object. This is because you cannot create new joints or mass objects in Character Edit Mode.
  • Browse to select the Resources\Tutorials\Tutorial 6 – Creating Props\HallTableBroken.fbx.
  • In the Import Options dialog, select the root node in the node tree hierarchy, and then click OK. This ensures that the new prop character will be created with its root joint based on the root joint in the source animation file. It is important that you select the correct node to use as the basis for your prop character.

Endo Tut06 ITE 04.jpg

  • You have now created a new prop character based on the character imported from this FBX file. Display the Node View to examine the structure of this character. You will notice that the root joint has three child joints. These joints will form the basis of three components making up the entire table.
  • Select the rootMass mass Object and delete it. This mass object is not required for the table.

To add a graphical object representing the prop shape:


  • Select the reference character. One way to do this is to select the Reference Character node in the Node View. Another approach is to click the Activate Reference Character button in the Main Toolbar. This button activates and selects the corresponding character.
  • Select File > Import, and browse to select the HallTableBroken.obj file. Do not modify any of the default import options. Click OK.
  • If you examine the graphical object carefully, you will see it is made up of three distinct parts that are joined along break lines. These indicate the three pieces of the table after it collapses following a collision.

Endo Tut06 ITE 05.jpg

To reshape the mass objects:


Before adding new collision objects, it is important to adjust the shape, size and position of the three mass objects so that they roughly reflect the size of their corresponding table component.

  • Select the Table01Mass mass object.
  • Use the Property Editor to change its geometry type to Cuboid.
  • Use the Move, Rotate and Scale tools to adjust the position and size of this mass object. The precise shape and size of this mass object does not matter. Your main aim is to ensure that the mass object is located at the centre of mass of the part of the table it represents, and has the right volume to reflect the mass of that table part.
  • Repeat this process for the other two mass objects. You should end up with three mass objects that are positioned roughly according to the screenshot below:

Endo Tut06 ITE 06.jpg

To fill out the prop with collision objects:


You can now start adding collision objects to fill out the three parts of the table. Before you create each collision object, select the corresponding mass object.

  • Select the Table01Mass object.
  • Click the Create Box Collision Object button on the Main Toolbar.
  • Use the Move, Rotate and Scale tools to adjust the size and position of this collision object. This collision object will form part of the table surface.
  • Continue creating collision objects that are children of the Table01Mass object until you have roughly represented the shape of the first section of the table surface. Keep in mind that you can penetrate collision objects that belong to the same mass object.

Endo Tut06 ITE 07.jpg

  • Create collision objects to fill out the other two sections of the table surface. You will need to create collision objects of the Table02Mass and Table03Mass objects respectively.
When you are creating these collision objects, keep in mind that you cannot allow collision objects belonging to different mass objects to penetrate. If this occurs, then when the object is simulated, you will find that the different sections of the table will rapidly spring apart as the penetrating collision objects attempt to separate themselves.

Endo Tut06 ITE 08.jpg

  • When you have finished filling out the three sections of the table, select File > Save Character, and name it BrokenTable. Click OK.

Step 3: Creating a chandelier

In this step we will build a simple rigid prop character that represents a chandelier. This will be a simple, rigid prop character based upon the Standard Prop Character. It will be made up of a single joint and a single mass object.

To create a chandelier:


  • Select File > New Character…, and select the Standard Prop Character. Click OK.
  • Select the rootMass object.
  • Select File > Import…, and browse to select the Resources\Tutorials\Tutorial 6 – Creating Props\ HallChandelierBody.obj. Do not modify the default Import Options. Click OK. A graphical object in the shape of a chandelier is created.
  • Select the graphical object, and use the Move tool to move it so that the rootMass object is located roughly at the centre of mass of the chandelier.

Endo Tut06 ITE 09.jpg

To reshape the mass object:


The mass object needs to be reshaped to better match the mass distribution of the chandelier.

  • Select the rootMass object.
  • Use the Property Editor to change its Type property to Cylinder. Also, set its Radius property to 0.7, and its Length property to 1.5.
  • Use the Move and Rotate tools, reposition the cylindrical mass object so that its long axis coincides with the axis of the chandelier.
  • The mass object now has a mass distribution that more closely resembles the distribution of mass in the chandelier. However, the overall mass of the object—which depends on its volume and density—is now unrealistically large. Use the Property Editor to reduce its Density property to from 0.9 to 0.3. This will reduce the overall mass of the chandelier by two-thirds, which will make it more responsive to forces.

Note that when you move and rotate a mass object using the Move and Rotate tools, any child collision graphical objects which belong to it will move and rotate with it while maintaining their position relative to it. If you scale the parent mass object using the Scale tool however, any child mass objects will remain unaffected.

To fill out the prop with collision objects:


  • As in previous examples, the chandelier graphical object needs to be filled out with collision objects. Keep in mind that you must preselect the rootMass object before creating each new collision object.
  • You may want to hide the rootMass object while you are adding collision objects. When mass objects are large, they can sometimes obscure their child collision objects. To hide this mass object, click on its icon in the Node View. This method hides the specific mass object selected. Alternatively, right-click in the viewport and turn off Mass Objects. This method hides all mass objects in the scene using a global filter, regardless of whether their individual visibilities are turned on or off.

Endo Tut06 ITE 10.jpg

  • When you have finished filling out the chandelier graphical object, select File > Save Character, and save this prop character as MyChandelier. Click OK.

Step 4: Adding a chandelier chain to a scene

In this step we will create a new scene and add the MyChandelier prop character to the scene.

You will then use a constraint event to temporarily connect the chandelier to a set of objects representing a chain holding the chandelier to a virtual ceiling. Constraints are very useful when you want to temporarily connect characters—or parts of characters—together. By carefully choosing when to apply and release constraints, you can generate many complex physical effects. This technique was first described in Tutorial 4.

To add a chandelier chain to a scene:


  • Select File > Open Scene, and open the Resources\Tutorials\Tutorial 6 - Creating Props\Tutorial 6 - Creating Props - Begin.ens scene. This is a copy of the scene that you worked on in Tutorial 4 – Creating Environments.
  • Delete all timeline events in the Timeline Editor.
  • Select File > Import, and browse to select the HallChandelierChain.fbx file from the folder. Turn off the Create Animation Event and Create Simulation Events settings. Click OK.
  • The HallChandelierChain.fbx file contains a character in the form of an articulated chain. When this file is imported into endorphin, a new prop character is created directly in the scene.
You can create prop characters directly in scenes by importing FBX, BVH, XSI, ASF or Vicon VSK files directly, as an alternative to using Character Edit Mode. However, the prop character will not have been saved out as an .nmc character file, and so cannot be used in other scenes. However, this approach is useful when you do not need to reuse props in other scenes.
If you do decide to reuse a prop character that you have created by directly importing a file, you can select that character in the scene, and then select File > Export and save the character as an .nmc endorphin character file.
  • Select the HallChandelierChain character in the Timeline Editor.
  • Use the Move tool to move the chain character until the topmost point of the chain coincides with the ceiling.

Endo Tut06 ITE 11.jpg

Step 5: Connecting a chandelier to the chain

In this step, we will add an instance of the chandelier prop character to the scene, and then use a constraint to connect it to the chain prop character that you created in the previous step.

To add a chandelier prop to the scene:


  • Select Character > Add Character.
  • Browse to the Resources\Tutorials\Tutorial 6 - Creating Props folder.
  • You should find that the MyChandelier prop character now appears in the Add Character dialog. Select this character and click OK.
  • Use the Move tool to move the new chandelier prop character up so that it sits just under the chain prop.

Endo Tut06 ITE 12.jpg

To connect the chandelier to the chain:


  • Right-click on the MyChandelier character timeline in the Timeline Editor, and select Create Constraint Event. This will add a new constraint event to the scene, with the chandelier rootMass mass object as the constrained mass object.
  • In Selection mode, hold down the Ctrl key, and select the four end-most mass objects of the HallChandelierChain_fbx character. This adds these mass objects to the set of constrained mass objects.
  • Exit Selection mode by right-clicking in the viewport, or by pressing the Esc key.
  • Ensure that the new constraint event is selected.
  • Use the Property Editor to set its Start Frame to Frame 0, and its End Frame to Frame 500.
  • Use the Property Editor to set its Type to JoinBodies.
The default constraint type is Lock, which locks the position and orientation of the selected mass objects in global coordinates. The JoinBodies constraint type does not enforce any global position or orientation. Rather, it temporarily constrains the selected mass objects to maintain their relative positions and orientations for the duration of the event.

To connect the chandelier chain to the environment:


  • Right-click on the HallChandelierChain character timeline in the Timeline Editor, and select Create Constraint Event. This will add a new constraint event to the scene, with the chain joint1Mass mass object as the constrained mass object. This is the topmost mass object.
  • Use the Property Editor to set its Start Frame to Frame 0, and its End Frame to Frame 500.

To swing the chandelier:


The chain has been constrained so that its topmost mass object has its position and orientation locked in global coordinates. Also, the chandelier has been constrained so that it is joined to the mass objects at the lower ends of the chain.

  • Simulate the scene. You should find that the chandelier will slightly drop under the influence of gravity until the chain is stretched to its limit.
The chain is made up of a series of short joints. This is a useful technique when you want to model chains, cables and other flexible entities. To test the flexibility of the chain, apply a horizontal force to the chandelier to set it swinging.
  • Right-click on the MyChandelier character timeline, and select Create Force Event.
  • With the force event selected, use the Property Editor to set its Strength to 3.0.
  • Simulate the scene again. The chandelier should now swing as a result of this force. You may find that the chain wobbles as it swings.
  • You can slightly stiffen the chain by adding an active pose event to the chain prop character. Right-click on the HallChandelierChain character, and select Create Active Pose Event.
  • With the active pose event selected, use the Property Editor to set its Start Frame to Frame 0 and its End Frame to Frame 500. If you simulate again, you should find that the chain appears slightly stiffer and the wobbling is reduced. To enhance or reduce this effect, modify the Strength property of the active pose event.
  • Delete the force event. We added the force to test the flexibility of the chain. The force is not required for the intended final scene simulation.

Step 6: Simulating the scene

In this step, we will add instances of the Table and Chair prop characters to the scene created in the previous step. We will also add an instance of the standard simulation character to the scene, and have this character interact with the table, chair and chandelier.

To add a table to the scene:


  • Select Character > Add Character, and select the BrokenTable character. Click OK.
  • Select this character, and use the Move tool it to position it near the staircase, under the chandelier. See the screenshot below for guidance.

Endo Tut06 ITE 13.jpg

To add some chairs to the scene:


  • Select Character > Add Character, and select the Chair character. Click OK.
  • Select this character, and use the Move and Rotate tools to position it so that it is sitting next to the table.
  • Add a second instance of the Chair prop character, and use the Move and Rotate tools to position it so that it is sitting on the opposite side of the table to the first chair.

To simulate the character jumping towards the chandelier:


  • The scene already has an instance of the standard simulation character standing on the top of the platform. Select this character by clicking the Character01 in the Timeline Editor.
  • Use the Rotate tool to rotate the character so that it is facing the chandelier.
  • Use the Move tool to move the character slightly closer to the edge of the platform.
  • Right-click on the Character01 timeline track and select Create Behaviour Event. This creates a new behaviour event for this character.
  • Use the Property Editor to set the behaviour event Name to Jump And Dive. Also, set the Start Frame to Frame 0.
  • Delete the Prop0, Prop01, Prop02 and Prop03 mass objects that make up part of the railing in front of the character. They are not required for this simulation.
  • Simulate the scene. The character should now jump forward towards the chandelier, and should collide with it.

Endo Tut06 ITE 14.jpg

To simulate the character reaching out for the chandelier:


This scene will be appear more realistic if the character reaches out towards the chandelier.

  • Select the Jump And Dive behaviour event, and use the Property Editor to set its End Frame to Frame 75.
  • Create another behaviour event on the same Character01 timeline.
  • Set the Name of this behaviour event to Hands Reach And Look At. Also, set its Start Frame to Frame 75.
  • Locate the [Select] command hotlink in the Property Editor that is associated with the LookAtTarget. Click this command hotlink to enter Selection mode, and select the Cylinder11 collision object. Repeat this process for the LeftHandTarget property.

Endo Tut06 ITE 15.jpg

  • Simulate the scene again. When the character jumps, it should now reach out for the chandelier with its left hand. Also, its head should point towards the chandelier as it jumps.

To simulate the character catching the chandelier:


Our next goal during this simulation is to ensure that the character successfully catches the chandelier, rather than simply colliding with it.

  • Right-click on the Character01 timeline, and select Create Constraint Event to create a new constraint. This should be roughly around Frame 110.
  • Use the Time Slider to identify the frame at which the character’s hand collides with the chandelier. Set its Start Frame of the new constraint event to match this frame.
  • Select the constraint, and use the Property Editor to set its Type to JoinBodies.
  • Click the [Select] command hotlink that is found next to the Target Objects property in the Property Editor. This places you in Selection mode.
  • In Selection mode, select the LeftHandMass mass object of Character01. Hold down the Ctrl key to select additional objects. Select any object in the chandelier prop. This will add the rootMass object to the constraint event target object set.
  • Simulate again. The character should now jump and hold on to the chandelier, and then swing underneath it. The character remains attached to the chandelier due to the effect of the constraint event. When the constraint event finishes, the character falls and collides with the table and chairs underneath the chandelier. Constraint events are useful when you want to mimic the effect of a character holding onto an object.
  • To make the character writhe as it holds onto the chandelier, adjust the End Frame property of the Hands Reach And Look At behaviour so that it matches the Start Frame of the constraint event that connects the character’s left hand to the chandelier. Then, add a new behaviour to the Character01 timeline, and set its Name property to Writhe.
  • Simulate again. The character should now writhe as it dangles under the chandelier.

To allow the table to collapse:


When the character collides with the table at the end of this simulation, we want the table to collapse. To do so, we need to sever the joints that are holding the table prop character together.

  • Use the Time Slider to identify the frame at which the character first collides with the table. This should be roughly around Frame 200.
  • Right-click on the BrokenTable_ref character timeline, and select Create Sever Event.
  • Adjust the Frame of the sever event so that it coincides with the character striking the table.
  • Locate the [Select] command hotlink associated with the Target Object property in the Property Editor. Click this command hotlink to enter Selection mode.
  • In Selection mode, hold down the Ctrl key and select each of the table sections. The corresponding mass objects are added to the sever event Target Objects list.
  • To exit selection mode, right-click in the viewport, or press the Esc key.
  • Simulate again. The table will now break into three separate sections when the character collides with it. This is because the sever event detaches each of the parent joints of the mass objects in the Target Objects list.

Endo Tut06 ITE 16.jpg

Experimenting with this scene


There are different ways you can modify the flow of action in this scene. For example:

  • Try experimenting with different behaviours on the simulation character to get different results.
  • Try changing the duration of the constraint that joins the simulation character to the chandelier.
  • Try adding some helper forces to the chairs at the frame in which the simulation character collides with the table. Helper forces can help create more dramatic action.

Conclusion

In this tutorial, you have learned how to create more complex prop characters using different techniques. You have also used a range of different event types to create dynamic interaction between a simulation character and various environment objects and prop characters.

If you have any problems with this tutorial, open the corresponding scene Resources\Tutorials\Tutorial 6 – Creating Props\Tutorial 6 – Creating Props - Complete.ens. This scene is an example of how your scene should look if you have successfully followed all the steps in this tutorial.

Личные инструменты
Пространства имён
Варианты
Действия
Навигация
Разделы TES
Разделы Fallout
Модмейкерам
Инструменты