官术网_书友最值得收藏!

Components

Components add additional functionality to a GameObject. These components come in many forms. Here are some of the components we already have or will see in this chapter:

  • Transform: The job of this component is to define the position, rotation, and scale of each GameObject in a scene. This is the minimum defining element of a GameObject, so all GameObjects have one.
  • Camera component: We have seen this component when we set up the camera earlier in this chapter.
  • Mesh renderer: This handles details of lighting and materials.
  • Rigidbody: This component allows you to control how the GameObject reacts to physics.
  • Box collider: This component adds a way to detect and react to collisions in the program.

As a point of reference, a simple cube is made up of five components. First we have the Transform component, whose job it is to set the Position, Rotation, and Scale of the object it is attached to. Another component is Box Collider, which provides the unity system with the ability to know when the object hits another object.

We also have the Mesh Renderer, here we can set certain properties involving materials and lighting. We can tell the object whether we want it to cast or receive shadows, we can change the materials applied to the 3D object as well.

主站蜘蛛池模板: 含山县| 天全县| 眉山市| 沙河市| 崇左市| 巴楚县| 文登市| 文化| 岱山县| 宁乡县| 临武县| 集安市| 长兴县| 乳山市| 通江县| 吴川市| 昌乐县| 大兴区| 桐梓县| 新晃| 江北区| 涟源市| 高安市| 宣化县| 广丰县| 正定县| 新化县| 长沙县| 开鲁县| 伊春市| 辽中县| 年辖:市辖区| 高陵县| 营山县| 尉犁县| 沛县| 武陟县| 神农架林区| 寿光市| 龙海市| 六安市|