On the earth of 3D modeling and animation, it is usually obligatory to maneuver objects round in your scene. Nevertheless, generally you could wish to transfer a guardian object with out shifting its youngster objects. This may be helpful for maintaining sure objects in place when you’re engaged on others.
There are just a few other ways to maneuver a guardian object with out shifting its youngster objects. The tactic you employ will rely upon the software program you are utilizing and the precise wants of your mission.
On this article, we’ll talk about the overall steps for shifting a guardian object with out shifting its youngster objects in standard 3D modeling and animation software program. We’ll additionally present some ideas and methods for working with parent-child relationships in your initiatives.
unity transfer guardian with out shifting youngster
Listed here are 10 necessary factors about shifting a guardian object with out shifting its youngster objects in Unity:
- Mother or father-child relationships
- Remodel element
- Native and world house
- Transfer guardian object
- Little one objects stay in place
- Relative positions maintained
- Use case: animation
- Use case: digicam motion
- Use case: recreation object group
- Greatest practices
By understanding and making use of these factors, you may successfully transfer guardian objects with out affecting their youngster objects, enhancing your workflow and mission outcomes in Unity.
Mother or father-child relationships
In Unity, objects could be organized right into a hierarchical construction utilizing parent-child relationships. This lets you group and manipulate objects collectively, making it simpler to handle complicated scenes.
-
Mother or father object
An object that incorporates a number of youngster objects.
-
Little one object
An object that’s contained inside a guardian object.
-
Hierarchy
The association of objects in a parent-child relationship, forming a tree-like construction.
-
Remodel element
A element that shops the place, rotation, and scale of an object within the scene.
If you transfer a guardian object, its youngster objects will usually transfer with it, as they’re linked collectively within the hierarchy. Nevertheless, there are methods to maneuver a guardian object with out shifting its youngster objects, which could be helpful in numerous conditions.
Remodel element
The Remodel element is a elementary element in Unity that shops and manipulates the place, rotation, and scale of an object within the scene. It’s hooked up to each object in Unity, together with guardian and youngster objects.
The Remodel element has three principal properties:
- Place: The place of the article in 3D house, represented by its x, y, and z coordinates.
- Rotation: The rotation of the article round its x, y, and z axes, represented by Euler angles or quaternions.
- Scale: The size of the article alongside its x, y, and z axes, represented by a multiplier worth.
If you transfer a guardian object, its youngster objects will usually transfer with it as a result of they inherit the guardian’s rework. Nevertheless, you may transfer a guardian object with out shifting its youngster objects by modifying the guardian’s Remodel element straight.
To maneuver a guardian object with out shifting its youngster objects, you should use the next steps:
- Choose the guardian object within the Hierarchy view.
- Within the Inspector view, find the Remodel element.
- Click on on the small arrow subsequent to the Place, Rotation, or Scale property to broaden the property.
- Enter new values for the x, y, and z elements of the property.
- Click on on the Apply button to use the modifications.
By following these steps, you may transfer the guardian object with out affecting the positions, rotations, or scales of its youngster objects.
This system could be helpful in numerous conditions, similar to animating a guardian object independently of its youngster objects, shifting a guardian object to a brand new location whereas maintaining its youngster objects in place, or organizing objects within the scene hierarchy.
Native and world house
In Unity, objects exist in each native house and world house. Native house is the house relative to the article itself, whereas world house is the worldwide house of the scene.
-
Native house
The house that’s centered on the article’s pivot level. The item’s place, rotation, and scale are outlined in native house.
-
World house
The worldwide house of the scene. All objects within the scene exist in world house, and their positions, rotations, and scales are outlined in relation to one another.
-
Mother or father-child relationship
When a toddler object is parented to a guardian object, the kid object’s native house is nested throughout the guardian object’s native house.
-
Shifting a guardian object
If you transfer a guardian object, its youngster objects will usually transfer with it as a result of they inherit the guardian’s rework. Nevertheless, you may transfer a guardian object with out shifting its youngster objects by modifying the guardian’s Remodel element in native house.
By understanding the ideas of native and world house, you may higher management the motion of objects in your scene, together with shifting guardian objects with out shifting their youngster objects.
Transfer guardian object
To maneuver a guardian object with out shifting its youngster objects, you should use the next steps:
- Choose the guardian object within the Hierarchy view.
- Within the Inspector view, find the Remodel element.
- Click on on the small arrow subsequent to the Place property to broaden the property.
- Enter new values for the x, y, and z elements of the Place property.
- Ensure that the “Native” checkbox is chosen subsequent to the Place property. This ensures that you’re modifying the guardian object’s place in native house, somewhat than world house.
- Click on on the Apply button to use the modifications.
By following these steps, you may transfer the guardian object with out affecting the positions of its youngster objects. The kid objects will stay of their authentic positions relative to the guardian object.
Listed here are some extra factors to remember when shifting a guardian object with out shifting its youngster objects:
- It’s also possible to use the Transfer software within the Scene view to maneuver a guardian object with out shifting its youngster objects. To do that, choose the guardian object after which click on on the Transfer software within the Toolbar. Place the cursor over the guardian object after which click on and drag to maneuver it to a brand new location. Ensure that the “Native” button is chosen within the Transfer software choices to maneuver the guardian object in native house.
- If you wish to transfer the guardian object and its youngster objects collectively, you should use the “Transfer with Youngsters” possibility within the Remodel menu. This selection will transfer the guardian object and all of its youngster objects collectively, sustaining their relative positions.
- It’s also possible to use scripting to maneuver a guardian object with out shifting its youngster objects. For instance, you can use the next code to maneuver a guardian object by 10 items alongside the x-axis in native house:
rework.localPosition += new Vector3(10, 0, 0);
By understanding find out how to transfer a guardian object with out shifting its youngster objects, you may achieve extra management over the motion of objects in your scene and create extra complicated animations and interactions.
Little one objects stay in place
If you transfer a guardian object with out shifting its youngster objects, the kid objects will stay of their authentic positions relative to the guardian object. It is because the kid objects’ positions are outlined in native house, which is relative to the guardian object’s house.
-
Native house
The house that’s centered on the article’s pivot level. The item’s place, rotation, and scale are outlined in native house.
-
World house
The worldwide house of the scene. All objects within the scene exist in world house, and their positions, rotations, and scales are outlined in relation to one another.
-
Mother or father-child relationship
When a toddler object is parented to a guardian object, the kid object’s native house is nested throughout the guardian object’s native house.
-
Shifting a guardian object
If you transfer a guardian object, its youngster objects will usually transfer with it as a result of they inherit the guardian’s rework. Nevertheless, you may transfer a guardian object with out shifting its youngster objects by modifying the guardian’s Remodel element in native house.
By understanding the ideas of native and world house, you may higher management the motion of objects in your scene, together with shifting guardian objects with out shifting their youngster objects.
Listed here are some extra factors to remember about youngster objects remaining in place once you transfer a guardian object:
- The kid objects will stay of their authentic positions relative to the guardian object, even in case you rotate or scale the guardian object.
- You may nonetheless transfer the kid objects individually, even when they’re parented to a guardian object. To do that, merely choose the kid object after which use the Transfer software or the Remodel element to maneuver it to a brand new place.
- If you wish to transfer the guardian object and its youngster objects collectively, you should use the “Transfer with Youngsters” possibility within the Remodel menu. This selection will transfer the guardian object and all of its youngster objects collectively, sustaining their relative positions.
By understanding how youngster objects stay in place once you transfer a guardian object, you may create extra complicated animations and interactions in your Unity initiatives.
Relative positions maintained
If you transfer a guardian object with out shifting its youngster objects, the relative positions of the kid objects to the guardian object are maintained. Which means the kid objects will stay in the identical positions relative to the guardian object, despite the fact that the guardian object has moved.
It is because the kid objects’ positions are outlined in native house, which is relative to the guardian object’s house. If you transfer the guardian object, the kid objects’ native house strikes with it, so the kid objects stay in the identical positions relative to the guardian object.
Listed here are some examples of how relative positions are maintained once you transfer a guardian object with out shifting its youngster objects:
- You probably have a guardian object with a toddler object positioned 10 items to the correct of the guardian object, and you progress the guardian object 20 items to the left, the kid object will now be positioned 30 items to the correct of the guardian object.
- You probably have a guardian object with a toddler object positioned 10 items above the guardian object, and also you rotate the guardian object 90 levels across the x-axis, the kid object will now be positioned 10 items to the left of the guardian object.
- You probably have a guardian object with a toddler object positioned 10 items in entrance of the guardian object, and also you scale the guardian object by 2, the kid object will now be positioned 20 items in entrance of the guardian object.
By understanding how relative positions are maintained once you transfer a guardian object with out shifting its youngster objects, you may create extra complicated animations and interactions in your Unity initiatives.
Listed here are some extra factors to remember about relative positions being maintained once you transfer a guardian object with out shifting its youngster objects:
- The relative positions of the kid objects to the guardian object might be maintained, even in case you transfer the guardian object in world house or native house.
- You may nonetheless transfer the kid objects individually, even when they’re parented to a guardian object. To do that, merely choose the kid object after which use the Transfer software or the Remodel element to maneuver it to a brand new place.
- If you wish to transfer the guardian object and its youngster objects collectively, you should use the “Transfer with Youngsters” possibility within the Remodel menu. This selection will transfer the guardian object and all of its youngster objects collectively, sustaining their relative positions.
By understanding how relative positions are maintained once you transfer a guardian object with out shifting its youngster objects, you may create extra complicated animations and interactions in your Unity initiatives.
Use case: animation
One widespread use case for shifting a guardian object with out shifting its youngster objects is in animation. For instance, you might need a guardian object that represents a personality’s physique, and youngster objects that symbolize the character’s limbs. You could possibly then animate the guardian object to maneuver the character across the scene, whereas maintaining the kid objects in place relative to the guardian object.
This lets you create complicated animations with out having to animate every particular person youngster object individually. For instance, you can create an animation of a personality strolling by merely shifting the guardian object ahead within the scene. The kid objects would mechanically transfer with the guardian object, sustaining their relative positions, so the character would look like strolling.
Listed here are some extra examples of how you should use shifting a guardian object with out shifting its youngster objects in animation:
- You could possibly animate a automobile driving by shifting the guardian object alongside a path, whereas maintaining the kid objects (such because the wheels and doorways) in place relative to the guardian object.
- You could possibly animate a hen flying by shifting the guardian object up and down, whereas maintaining the kid objects (such because the wings and tail) in place relative to the guardian object.
- You could possibly animate a tree blowing within the wind by shifting the guardian object forwards and backwards, whereas maintaining the kid objects (such because the leaves and branches) in place relative to the guardian object.
By understanding find out how to transfer a guardian object with out shifting its youngster objects, you may create extra complicated and sensible animations in Unity.
Listed here are some extra ideas for utilizing shifting a guardian object with out shifting its youngster objects in animation:
- Use the “Transfer with Youngsters” possibility within the Remodel menu to simply transfer the guardian object and its youngster objects collectively, sustaining their relative positions.
- Use the “Native” checkbox within the Remodel element to maneuver the guardian object in native house, in order that the kid objects stay of their authentic positions relative to the guardian object.
- Use animation curves to regulate the motion of the guardian object over time, permitting you to create clean and sensible animations.
By following the following pointers, you may create complicated and interesting animations in Unity utilizing the strategy of shifting a guardian object with out shifting its youngster objects.
Use case: digicam motion
One other widespread use case for shifting a guardian object with out shifting its youngster objects is in digicam motion. For instance, you might need a guardian object that represents the digicam’s place and rotation, and youngster objects that symbolize the digicam’s discipline of view, side ratio, and different settings.
You could possibly then transfer the guardian object to alter the digicam’s place and rotation, whereas maintaining the kid objects in place relative to the guardian object. This lets you create clean and cinematic digicam actions with out having to fret about adjusting the digicam’s settings individually.
Listed here are some extra examples of how you should use shifting a guardian object with out shifting its youngster objects in digicam motion:
- You could possibly create a cutscene by shifting the guardian object to completely different positions and rotations, whereas maintaining the kid objects (similar to the sphere of view and side ratio) in place.
- You could possibly create a first-person digicam by shifting the guardian object to observe the participant character, whereas maintaining the kid objects (similar to the sphere of view and side ratio) in place.
- You could possibly create a third-person digicam by shifting the guardian object to observe the participant character from a distance, whereas maintaining the kid objects (similar to the sphere of view and side ratio) in place.
By understanding find out how to transfer a guardian object with out shifting its youngster objects, you may create extra dynamic and interesting digicam actions in Unity.
Listed here are some extra ideas for utilizing shifting a guardian object with out shifting its youngster objects in digicam motion:
- Use the “Transfer with Youngsters” possibility within the Remodel menu to simply transfer the guardian object and its youngster objects collectively, sustaining their relative positions.
- Use the “Native” checkbox within the Remodel element to maneuver the guardian object in native house, in order that the kid objects stay of their authentic positions relative to the guardian object.
- Use animation curves to regulate the motion of the guardian object over time, permitting you to create clean and cinematic digicam actions.
By following the following pointers, you may create complicated and interesting digicam actions in Unity utilizing the strategy of shifting a guardian object with out shifting its youngster objects.
Use case: recreation object group
Shifting a guardian object with out shifting its youngster objects may also be helpful for organizing recreation objects in your scene.
-
Grouping associated objects
You may group associated objects collectively by parenting them to a guardian object. This will make it simpler to pick out, transfer, and manipulate the objects as a bunch.
-
Creating hierarchies
You may create hierarchies of objects by nesting guardian objects inside different guardian objects. This can assist you to arrange your scene and make it simpler to handle complicated objects.
-
Managing visibility and interplay
You may management the visibility and interplay of kid objects by enabling or disabling the guardian object. This may be helpful for hiding or displaying teams of objects, or for stopping gamers from interacting with sure objects.
-
Enhancing efficiency
In some circumstances, shifting a guardian object with out shifting its youngster objects can enhance efficiency. It is because Unity can extra effectively render and replace objects which are grouped collectively underneath a guardian object.
By understanding find out how to transfer a guardian object with out shifting its youngster objects, you may higher manage your recreation objects and enhance the efficiency of your Unity mission.
Greatest practices
Listed here are some finest practices for shifting a guardian object with out shifting its youngster objects in Unity:
-
Use the “Transfer with Youngsters” possibility.
If you wish to transfer a guardian object and its youngster objects collectively, use the “Transfer with Youngsters” possibility within the Remodel menu. This may be certain that the kid objects keep their relative positions to the guardian object.
-
Use the “Native” checkbox.
If you wish to transfer a guardian object with out shifting its youngster objects, ensure that the “Native” checkbox is chosen within the Remodel element. This may be certain that the guardian object is moved in native house, somewhat than world house.
-
Use animation curves.
If you wish to create clean and cinematic animations, use animation curves to regulate the motion of the guardian object over time. This may mean you can create animations which are extra sensible and interesting.
-
Set up your recreation objects.
Use guardian objects to group associated recreation objects collectively. This may make it simpler to pick out, transfer, and manipulate the objects as a bunch. It may well additionally assist to enhance efficiency by permitting Unity to extra effectively render and replace the objects.
By following these finest practices, you may successfully transfer guardian objects with out shifting their youngster objects in Unity, enhancing your workflow and mission outcomes.
FAQ
Listed here are some steadily requested questions (FAQs) about shifting a guardian object with out shifting its youngster objects in Unity:
Query 1: Why would I wish to transfer a guardian object with out shifting its youngster objects?
Reply: There are a number of the reason why you may wish to transfer a guardian object with out shifting its youngster objects. For instance, you may wish to:
- Animate a guardian object independently of its youngster objects.
- Transfer a guardian object to a brand new location whereas maintaining its youngster objects in place.
- Set up objects within the scene hierarchy extra successfully.
Query 2: How do I transfer a guardian object with out shifting its youngster objects?
Reply: You may transfer a guardian object with out shifting its youngster objects by following these steps:
- Choose the guardian object within the Hierarchy view.
- Within the Inspector view, find the Remodel element.
- Click on on the small arrow subsequent to the Place property to broaden the property.
- Enter new values for the x, y, and z elements of the Place property.
- Ensure that the “Native” checkbox is chosen subsequent to the Place property.
- Click on on the Apply button to use the modifications.
Query 3: What’s the distinction between native house and world house?
Reply: Native house is the house that’s centered on the article’s pivot level. The item’s place, rotation, and scale are outlined in native house. World house is the worldwide house of the scene. All objects within the scene exist in world house, and their positions, rotations, and scales are outlined in relation to one another.
Query 4: What’s the “Transfer with Youngsters” possibility?
Reply: The “Transfer with Youngsters” possibility is a button within the Remodel menu that permits you to transfer a guardian object and its youngster objects collectively. When you choose the “Transfer with Youngsters” possibility, the entire youngster objects might be moved together with the guardian object, sustaining their relative positions.
Query 5: How can I manage my recreation objects extra successfully?
Reply: You may manage your recreation objects extra successfully through the use of guardian objects to group associated objects collectively. This may make it simpler to pick out, transfer, and manipulate the objects as a bunch. It may well additionally assist to enhance efficiency by permitting Unity to extra effectively render and replace the objects.
Query 6: Are there any finest practices for shifting a guardian object with out shifting its youngster objects?
Reply: Sure, there are just a few finest practices that you could observe when shifting a guardian object with out shifting its youngster objects:
- Use the “Transfer with Youngsters” possibility to maneuver the guardian object and its youngster objects collectively.
- Use the “Native” checkbox to maneuver the guardian object in native house, somewhat than world house.
- Use animation curves to regulate the motion of the guardian object over time, creating clean and cinematic animations.
- Set up your recreation objects utilizing guardian objects to group associated objects collectively.
Closing Paragraph:
By understanding find out how to transfer a guardian object with out shifting its youngster objects, you may improve your workflow and create extra complicated and interesting animations and interactions in Unity.
Along with the knowledge supplied within the FAQ, listed here are some extra ideas for shifting a guardian object with out shifting its youngster objects in Unity:
Ideas
Listed here are some sensible ideas for shifting a guardian object with out shifting its youngster objects in Unity:
Tip 1: Use keyboard shortcuts.
You need to use the next keyboard shortcuts to rapidly transfer a guardian object with out shifting its youngster objects:
- W: Transfer the article ahead.
- S: Transfer the article backward.
- A: Transfer the article left.
- D: Transfer the article proper.
- Q: Transfer the article up.
- E: Transfer the article down.
Tip 2: Use the gizmos.
The gizmos are a set of visible instruments that mean you can manipulate objects within the scene. To maneuver a guardian object with out shifting its youngster objects utilizing the gizmos, merely click on and drag on the gizmo that corresponds to the axis you wish to transfer the article alongside. For instance, to maneuver the article ahead, click on and drag on the inexperienced arrow gizmo.
Tip 3: Use the Remodel element.
It’s also possible to transfer a guardian object with out shifting its youngster objects through the use of the Remodel element. To do that, choose the guardian object within the Hierarchy view, then find the Remodel element within the Inspector view. You may then enter new values for the x, y, and z elements of the Place property to maneuver the article. Ensure that the “Native” checkbox is chosen subsequent to the Place property to maneuver the article in native house, somewhat than world house.
Tip 4: Use animation curves.
Animation curves mean you can management the motion of an object over time. You need to use animation curves to create clean and cinematic animations of a guardian object shifting with out affecting its youngster objects. To create an animation curve, choose the guardian object within the Hierarchy view, then click on on the “Animation” tab within the Toolbar. You may then create a brand new animation curve by clicking on the “Add Curve” button.
Closing Paragraph:
By following the following pointers, you may successfully transfer guardian objects with out shifting their youngster objects in Unity, enhancing your workflow and mission outcomes.
In conclusion, understanding find out how to transfer a guardian object with out shifting its youngster objects is a elementary talent for working with parent-child relationships and creating complicated animations and interactions in Unity. By making use of the strategies and following the most effective practices mentioned on this article, you may successfully manipulate objects in your scenes and obtain the specified outcomes on your initiatives.
Conclusion
On this article, we explored the idea of shifting a guardian object with out shifting its youngster objects in Unity. We mentioned the significance of parent-child relationships and the excellence between native and world house. We additionally supplied detailed steps on find out how to transfer a guardian object with out shifting its youngster objects, in addition to finest practices and ideas for working with parent-child relationships in Unity.
By understanding and making use of the strategies mentioned on this article, you may successfully manipulate objects in your scenes and create complicated animations and interactions. Listed here are some key takeaways to recollect:
- Mother or father-child relationships mean you can manage and manipulate objects in a hierarchical construction.
- Native house is the house that’s centered on the article’s pivot level, whereas world house is the worldwide house of the scene.
- You may transfer a guardian object with out shifting its youngster objects by modifying the guardian’s Remodel element in native house.
- The “Transfer with Youngsters” possibility permits you to transfer a guardian object and its youngster objects collectively, sustaining their relative positions.
- Greatest practices for shifting a guardian object with out shifting its youngster objects embrace utilizing the “Transfer with Youngsters” possibility, utilizing the “Native” checkbox, and utilizing animation curves to regulate the motion of the guardian object over time.
掌握了移动父对象而不移动其子对象的技能,你就可以在 Unity 中有效地操作场景中的对象,并创建复杂的动画和交互,从而为你的项目实现预期的结果。
Finally, understanding find out how to transfer a guardian object with out shifting its youngster objects is a elementary talent for working with parent-child relationships and creating complicated animations and interactions in Unity. By making use of the strategies and following the most effective practices mentioned on this article, you may improve your workflow and obtain the specified outcomes on your initiatives.