22. Unity - 3D game development subtotal 01 --- Fix animation bugs, change ambient lighting, navigation grid, camera follow, scene rendering post-processing

1. Import the player character model

The material comes from the official website of unity: 3D Beginner:Tutorial Resources

In 3D game development, 3D object models are generally provided by other members of the team, including the model itself and animation files. What we need to do is to combine these materials and use code to control them.
If you add an animation file to the model, you may find that the model will have some incredible movements when running, such as slowly rising in the y-axis direction . This is because after the rigid body component is added to the 3D model , the update method of the animation component and the rigid body component The update method created a conflict.
In general, after the animation component is added , its default update method is Update Model = Normal . This update method calls the Update() function by default, and the update of the rigid body component will call the FixedUpdate() function (generally add a rigid body component to an object. Finally, the rigid body component will be used to move the object, and these codes are placed in the FixedUpdate function to avoid problems), and the two will conflict.
Therefore, some properties need to be changed. After adding rigid body components and animation components to the 3D character model, the relevant settings are as follows: The
insert image description here
above settings set the property Update Mode of the animation component
to Animate Physics, so that the FixedUpdated() function will be called when the frame is updated, and at the same time limit Rigid body components

Guess you like

Origin blog.csdn.net/FY_13781298928/article/details/130644701