Chúng ta sẽ thiết lập logic hình cầu. Đầu tiên, chúng tôi sẽ thêm một tài sản Game, mà tôi gọi là "col," bằng cách nhấn vào bất động sản Game nút Add như hình. 7,36. Tài sản này sẽ được sử dụng sau này chỉ kích hoạt các mô phỏng cho các mảnh mục tiêu khi phạm vi các cuộc đình công. | Creating 3D Game Art for the iPhone with Unity FIG The Ground Is Set to Static. set as Rigid Bodies. In order to accomplish this we ll need to set up some logic for the simulation which can be done through the Logic Editor. Setting Up the Logic We ll first set up the logic for the sphere. First we ll add a Game Property which I called col by clicking the Add Game Property button as shown in Fig. . This property will be used later to only trigger the simulation for the target pieces when the sphere strikes them. For the UV Sphere we ll need to create two layers of logic. The first layer will suspend the dynamics so when we start the simula tion the gravity won t automatically affect the Rigid Body objects. The second layer re-enable the dynamics but only after we hit the space bar. In Fig. you can see both layers highlighted. The first layer consists of an Always Sensor a And Controller and one Edit Object Actuator set to Suspend Dynamics. As you can see from Fig. these items are piped together. The second layer of logic consists of a Keyboard Sensor set to Spacebar an And Controller and two Actuators an Edit Object set to Restore Dynamics and a Motion Actuator set to simple motion with a value of in the Y-axis. Again in Fig. you can see how this logic is piped together. The second layer of logic is stated that when the Spacebar is pressed dynamics will be restored and a motion of will be applied to the UV Sphere in the Y-axis which will push the ball into the target. Next we ll need to set up the logic for each piece of the target. It s a very similar setup in that there are two layers of logic. The first layer will suspend the dynamics and the second layer will re-enable the dynamics but instead of using a Keyboard Sensor we ll use a Collision Sensor. The collision event will be the UV Sphere colliding with FIG ITeBiilIrt Physics Engine the ball and we ll use the col Game Property set on the UV Sphere to tell Defaults to .