Unity3d game development from zero single row (V)-import CS model to unity3d

Source: Internet
Author: User
Game animation basic animation Components

The animation component is for the old animation system.

The old animation is the same as the corresponding animation is clip. Each motion is a separate animation. Play () or crossfade () is used to play the animation directly or fade in and out.

animation.Play("name");animation.CrossFade("name");

The following are its attributes:



Animation: the default animation fragment;

Aniamtions: Includes animated clips;

Play automatically: whether to actively play the video;

Aniamate physics: whether the animation should interact with the physical.
Culling type: When the animation is not played.
Always play the animation (always animate) and always play the animation.
Based on the Renderer (based on renderers) based on the default animation posture removal.
Based on the clip bounds (calculated during the import process), the animation is not played if the clip bounds exceeds the view.
Based on user bounds (based on user bounds) removes user-defined boundary. If the user-defined boundary exceeds the view, no animation is played.


Animator component

The new animation system macanim provides an animator component for controlling role animation, which cannot be used at the same time.

The animator component also has the following attributes:

Controller: animator controller resource;

Avator: skeleton model

(Note: What is Avatar? Due to the similarity of the skeleton structure, it is possible to map an animation from a humanoid skeleton to another humanoid skeleton, and also to redirect and Reverse dynamics. With few exceptions, humanoid models can be thought of as having the same structure, with clear bodies, heads, and limbs. The mecanim system uses this idea very well to simplify frame creation and animation control. One basic step for creating an animation is to set an unity3d understandable ing of a simplified humanoid skeleton to the actual skeleton in the skeleton. In mecanim terminology, this ing is called Avatar)

Apply root motion: whether to use rootmotion. If we select this option, when playing an animation, the range of the animation motion is used to change the role's transform. If we do not select this option, we can use scripts to set the role's Tranform.

The following two options are basically the same as those of the animation component.


Animator Controller

The animator controller is used to set the behavior of a role. These include state machines, fusion trees, and events controlled by scripts. Unity provides a visual form for editing the animator controller to open an animator controller, which is like this:



ADD? Various States and variables allow the role to change freely in various states, and the Controller resources can be reused. If two models have the same avatar, then the controller can apply them directly.

The State in the state machine can be either a single clip or a hybrid tree. Build and edit complex state machines and hybrid trees to fully control how the role moves. The Unity Editor provides powerful tools for cutting, creating loops, and extracting tracks from imported animation files. These animated clips can then be used as leaves of a multi-layered hybrid tree or as a State in a layered state machine. The hybrid tree allows you to create a variety of motion with just a few animated clips. In the hybrid tree editor, you can define the number of hybrid animations and preview them in a 3D view. Like an animated clip, a hybrid tree can be used as a State in a layered state machine.


Import the CS model to unity3d

CS should be the first FPS game of our generation. Although it was a product of the 2000 s, even today, the quality is also world-class.

The following describes how to extract the model in cs1.6 to unity3d.

Related Software:

Unity3d 4.2

Milkshape 3D 1.8.4-decomposed MDL Model

SMD importer_v1.0-import SMD model to 3 DSMAX

3dsmax2009-edit the model and export the fbx Model

Jed's half-life model viewer-view game models

1. decomposition model

First, you must have cs1.6.

After Jed's half-life model viewer is installed, the game model can be loaded into the corresponding model path.


The related paths are as follows:

Unified path cstrike \ models \ player
Bandit 1 terror \ terror. MDL
Bandit 2 Leet \ leet. MDL
Bandit 3 Arctic \ Arctic. MDL
Bandit 4 guerilla \ guerilla. MDL
Alert 1 Urban \ urban. MDL
Alert 2 GSG9 \ gsg9.mdl
Alert 3 SAS \ SAS. MDL
Policemen 4 GIGN \ GIGN. MDL
VIP \ VIP. MDL

For more details, refer here.

Next, we need to break down the MDL model into SMD models. The tool used is milkshape.


(Note: MDL and SMD Models

The MDL file is not just a model file. It is a file package containing models, textures, all actions, and scripts. The MDL model in CS is composed of a control file (with the extension of QC) and a data file (with the extension of SMD) plus a texture (only a 256-color BMP bitmap in Windows format, and its length and width must all be multiples of eight .) Compiled. The QC File Stores model attachments, contact points, submodels, and other data, and specifies the SMD file to be read during compilation. There are two SMD types. One is to record model information, including model, skeleton, hitbox, and skin texture. The other is the action lens, which records the position of each frame of the skeleton to form an animation .)


Open milkshape, tools-> half-life-> decompile normal hl mdl file-> select the MDL file to be decompressed.
For a moment, the solution is QC, BMP, and a lot of SMD files. We need SMD.



2. Import SMD to 3 DSMAX

First, install the plug-in and put the extracted smdimporterx64.dli file into X: \ Program Files \ Autodesk \ 3DS MAX 2009 \ plugins. X is the drive letter of your software installation.

Open 3dsmax2009. File-> Import, select SMD, locate gsg9.smd, and load.



The loaded model has no textures, so you need to manually assign the materials. Edit the material-> diffuse reflection-> bitmap, select the decomposed BMP texture, and load it.



Assign the material ball and turn on the texture switch. The model will be displayed normally.



Export Animation

Import run. SMD. You can drag the slider to open the running animation (reverse---is found --).

File-> export fbx. Check animation and embed media. and click OK.


Load fbx model into unity3d

Open unity3d, create a new project, and drag the exported fbx model to assets. In inspector, set rig and animation type to humanoid. The default value is apply.



Next, create an animation controller, create-> animation controller, and drag the run animation that comes with fbx into the controller.


Yellow indicates the default animation.

Next, we can drag the model into the scene. The animation controller is dragged to the corresponding position of the animator component.


For Loop animation, select loop pose on the animation tab of the model.


Next, we were able to use our scripts to control the movements of people ^.


Exam

Solving unity3d 4.3 animation system troubles-http://blog.sina.com.cn/s/blog_7dcf9f690101p22x.html

Export the CS model from 3dmax to the X-format model-http://linuxtest.blog.163.com/blog/static/1999270882013128103226704/


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.