Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| brasil:courses:blender_unity:unity:5_the_solar_system [2026/08/25 22:48] – [Saturn’s Rings] yann | brasil:courses:blender_unity:unity:5_the_solar_system [2026/08/27 15:16] (Version actuelle) – [Ship Controller] yann | ||
|---|---|---|---|
| Ligne 25: | Ligne 25: | ||
| **Project backup: highlighted directories only** | **Project backup: highlighted directories only** | ||
| - | {{: | + | {{ : |
| </ | </ | ||
| Ligne 35: | Ligne 35: | ||
| The planets’ orbits can be shown or hidden, and the planets will move at speeds proportional to their respective orbital periods. | The planets’ orbits can be shown or hidden, and the planets will move at speeds proportional to their respective orbital periods. | ||
| - | {{: | + | {{ : |
| Here are some guidelines: | Here are some guidelines: | ||
| - | {{: | + | {{ : |
| The following diagram shows the actual relative sizes of the planets: | The following diagram shows the actual relative sizes of the planets: | ||
| Ligne 68: | Ligne 68: | ||
| ====== Ship Controller ====== | ====== Ship Controller ====== | ||
| + | Here's the spaceship control script in C#, self-contained (it creates its own InputActions in code, so no separate .inputactions asset is needed — but the Input System package still needs to be installed, and Active Input Handling must be set to "Input System Package (New)" or " | ||
| + | <note tip> | ||
| + | **This code has been generated with Claude AI.** | ||
| + | //**Prompt :**// You are a Unity 3D developer. Write a script that allows a **spaceship to be controlled using the keyboard and mouse**, using the **New Input System package**. The various flight parameters/ | ||
| + | |||
| + | </ | ||
| <code csharp> | <code csharp> | ||
| using UnityEngine; | using UnityEngine; | ||
| Ligne 206: | Ligne 212: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | What it does | ||
| + | * **W/S**: move forward/ | ||
| + | * **A/D**: strafe left/right. | ||
| + | * **Space / Left Ctrl**: move up/down. | ||
| + | * **Mouse**: pitch and yaw. | ||
| + | * **Q/E**: roll, with its own acceleration. | ||
| + | * **All speed/ | ||
| + | |||
| + | |||
| + | Things worth double-checking | ||
| + | * I'm not fully certain which exact Input System package version is in your project — the composite names (" | ||
| + | * The script assumes rb.linearVelocity / rb.linearDamping (names used since Unity 6) exist in your Unity version. If you're on a pre-Unity-6 version, replace them with rb.velocity and rb.drag / rb.angularDrag. | ||
| + | * Gravity is already disabled in the script (rb.useGravity = false), but check that no other component re-enables it. | ||
| + | |||
| + | ====== Results ====== | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
