Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
brasil:courses:blender_unity:unity:4_moving_objects [2026/08/25 19:04] – [Attaching a C# Script to a GameObject] yannbrasil:courses:blender_unity:unity:4_moving_objects [2026/08/25 19:29] (Version actuelle) – [Exercise] yann
Ligne 120: Ligne 120:
 To test our code, we're going to run our game in the editor: To test our code, we're going to run our game in the editor:
  
-{{:brasil:courses:blender_unity:unity:unityplayeditor-1024x163.png?1024|}}+{{ :brasil:courses:blender_unity:unity:unitygamemode.png |}}
  
 If you press the spacebar, you'll notice that the Earth disappears (it is no longer displayed by the render engine because its GameObject's visibility is turned off). If you press the spacebar, you'll notice that the Earth disappears (it is no longer displayed by the render engine because its GameObject's visibility is turned off).
Ligne 126: Ligne 126:
 Stay in Play mode (with the Game tab active), select the Earth GameObject in the hierarchy on the left if you haven’t already, and check the status of the GameObject’s visibility checkbox in the Inspector on the right. Stay in Play mode (with the Game tab active), select the Earth GameObject in the hierarchy on the left if you haven’t already, and check the status of the GameObject’s visibility checkbox in the Inspector on the right.
  
-{{:brasil:courses:blender_unity:unity:unityscriptshowhidecheckbox.png|}}+{{ :brasil:courses:blender_unity:unity:unityhideaction.png |}} 
 +{{ :brasil:courses:blender_unity:unity:unityhideaction2.png |}}
  
 The interface reflects the changes made by the running code when you are in Play mode. This provides a basic level of visual debugging within the editor. The interface reflects the changes made by the running code when you are in Play mode. This provides a basic level of visual debugging within the editor.
Ligne 134: Ligne 135:
 Debug.Log statements write a log to the editor console. These logs are a starting point for debugging; they let you know which lines of code have been executed and even display the values of variables. Debug.Log statements write a log to the editor console. These logs are a starting point for debugging; they let you know which lines of code have been executed and even display the values of variables.
  
-{{:brasil:courses:blender_unity:unity:unityconsole.png|}}+{{ :brasil:courses:blender_unity:unity:unityconsoledebug.png |}}
  
 ===== The Earth rotates... ===== ===== The Earth rotates... =====
Ligne 145: Ligne 146:
 using UnityEngine; using UnityEngine;
  
-public class EarthRotation : MonoBehaviour+public class earthRotate : MonoBehaviour
 { {
     public Vector3 localRotationSpeed;     public Vector3 localRotationSpeed;
  
-    // Start is called before the first frame update +    // Start is called once before the first execution of Update after the MonoBehaviour is created 
-    private void Start()+    void Start()
     {     {
 +        
     }     }
  
     // Update is called once per frame     // Update is called once per frame
-    private void Update()+    void Update()
     {     {
         this.transform.Rotate(localRotationSpeed * Time.deltaTime, Space.Self);         this.transform.Rotate(localRotationSpeed * Time.deltaTime, Space.Self);
Ligne 167: Ligne 168:
 Set the Y-axis to 50. Set the Y-axis to 50.
  
-{{:brasil:courses:blender_unity:unity:unityearthrotationscript.png|}}+{{ :brasil:courses:blender_unity:unity:unityearthrotatescriptannoted.png?1024 |}}
  
 This variable is of type Vector3, meaning it’s a 3-dimensional vector that can store a value for the X axis, a value for the Y axis, and a value for the Z axis. This variable is of type Vector3, meaning it’s a 3-dimensional vector that can store a value for the X axis, a value for the Y axis, and a value for the Z axis.
Ligne 176: Ligne 177:
 In the editor, you can see in real time that your script is changing the GameObject’s rotation along the Y-axis. In the editor, you can see in real time that your script is changing the GameObject’s rotation along the Y-axis.
  
-{{:brasil:courses:blender_unity:unity:unitytransformrotationupdated.png|}}+{{ :brasil:courses:blender_unity:unity:unityearthrotationvalue.png |}}
  
 ===== Conclusion ===== ===== Conclusion =====
Ligne 184: Ligne 185:
 ===== Exercise ===== ===== Exercise =====
  
-  - Add a Milky Way skybox; to do this, use the Asset Store (Milky Way Skybox)+  - Add a Milky Way skybox; to do this, use the Asset Store (Milky Way Skybox) or the file {{ :brasil:courses:blender_unity:unity:milkywayskybox.unitypackage |}}
   - Make the moon rotate on its axis   - Make the moon rotate on its axis
   - Make the moon orbit the Earth   - Make the moon orbit the Earth
brasil/courses/blender_unity/unity/4_moving_objects.1787677461.txt.gz · Dernière modification : de yann
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0