<span id="Label3"></p><span style="font-size: 18px"><span style="font-size: 18px">1. Introduction</span></span><p><p><span style="font-size: 18px">in unity3d, There are many ways to change the coordinates of an object, to achieve the purpose of moving, its essence is to modify the position of the object every Frame. </span></p></p><p><p></p></p><p><p></p></p><span style="font-size: 18px"><span style="font-size: 18px">2. Moving objects through the transform component</span></span><p><p><span style="font-size: 18px">The Transform component is used to describe the state of an object in space, including position (position), rotation (rotation), and scaling (scale). In fact, all movements lead to position changes, as described here by moving objects through the transform component, referring to the direct manipulation of the transform to control the position of the object (position).</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">2.1 transform.translate</span></span><p><p><span style="font-size: 18px">This method moves the object from its current position to the specified position, and can select the coordinate system of the REFERENCE. When you need a coordinate system transformation, consider using this method to omit the steps to convert the coordinate system.</span></p></p><p><p><span style="font-size: 18px"><span style="font-size: 18px"><span style="font-size: 18px">public <em>function Translate (translation:vector3, relativeto:space = space.self): void;</em><br></span></span></span></p></p><span style="font-size: 18px"><span style="font-size: 18px">2.2 vector3.lerp, vector3.slerp, vector3.movetowards</span></span><p><p><span style="font-size: 18px"><span style="font-size: 18px"><span style="font-size: 18px"><span style="font-size: 18px">Vector3 can represent either a point in a three-dimensional space or a vector. These three methods are interpolation methods, lerp is linear interpolation, slerp is spherical interpolation, movetowards on the basis of LERP added limit maximum speed Function. These methods can be considered when you need to move from the specified point A to point B.<br></span></span></span></span></p></p><span style="font-size: 18px"><span style="font-size: 18px">2.3 Vector3.smoothdamp</span></span><p><p><span style="font-size: 18px">The method can be smoothed from a gradually to point b, and can control the speed, the most common use is the camera to follow the Target.</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">2.4 transform.position</span></span><p><p><span style="font-size: 18px"><span style="font-size: 18px"><span style="font-size: 18px"><span style="font-size: 18px"><span style="font-size: 18px">Sometimes re-assigning position can achieve our goals Faster.</span></span></span></span></span></p></p><p><p></p></p><p><p></p></p><span style="font-size: 18px"><span style="font-size: 18px">3. Moving objects through the Rigidbody component</span></span><p><p><span style="font-size: 18px">Rigidbody components are used to simulate the physical state of an object, such as when an object is affected by gravity, when the object is hit by a collision, and so On.</span></p></p><p><p><span style="font-size: 18px">Note: calls to Rigidbody should be placed in the Fixedupdate method, which is called every time a physical simulation is Performed.</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">3.1 rigidbody.velocity</span></span><p><p><span style="font-size: 18px">Setting the body speed allows the object to move and ignore the static friction, which causes the object to move quickly from the stationary state to the motion State.</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">3.2 Rigidbody.addforce</span></span><p><p><span style="font-size: 18px">A force that adds a direction to a rigid body, which is suitable for simulating the motion of an object under external Forces.</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">3.3 rigidbody.moveposition</span></span><p><p><span style="font-size: 18px">When a rigid body is physically constrained, move to a specified point.</span></p></p><p><p></p></p><p><p></p></p><span style="font-size: 18px"><span style="font-size: 18px">4. Moving objects through the Charactercontroller component</span></span><p><p><span style="font-size: 18px">Charactercontroller is used to control the movement of First-person or Third-person characters, which can be used to simulate human behavior, such as limiting the maximum slope of a character's climb, the height of the pace, etc.</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">4.1 charactercontroller.simplemove</span></span><p><p><span style="font-size: 18px">For simulating simple motion and automatically applying gravity, the return value indicates whether the role is currently on the Ground.</span></p></p><span style="font-size: 18px"><span style="font-size: 18px">4.2 charactercontroller.move</span></span><p><p><span style="font-size: 18px">To simulate more complex motions, gravity needs to be implemented by code, and the return value represents the collision information between the character and the Surrounding.</span></p></p><p><p>Unity3d character (object) Move method collection</p></p></span>
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