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

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.

主站蜘蛛池模板: 泽普县| 剑川县| 山丹县| 浪卡子县| 原阳县| 赞皇县| 和平县| 芷江| 鄂州市| 鄂伦春自治旗| 积石山| 淮北市| 莆田市| 静乐县| 凌海市| 韩城市| 久治县| 新竹县| 农安县| 安仁县| 临西县| 策勒县| 即墨市| 渭南市| 双辽市| 安乡县| 普洱| 永州市| 出国| 剑河县| 赣州市| 灌南县| 易门县| 平顺县| 和龙市| 吴旗县| 佳木斯市| 信丰县| 浪卡子县| 化德县| 铜山县|