Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Duverne <[email protected]>
  • Loading branch information
glabute and sebastienduverne authored Jun 11, 2024
1 parent c5f45a0 commit f137689
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 87 deletions.
118 changes: 59 additions & 59 deletions com.unity.cinemachine/Documentation~/SimplePlayerController.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions com.unity.cinemachine/Documentation~/samples-tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The Cinemachine package includes sample scenes that you can [import to your proj
| 3D Samples | Sample scenes illustrating various ways to use Cinemachine in a 3D setting.<br />Includes: `Brain Update Modes`, `ClearShot`, `Custom Blends`, `Cutscene`, `FadeOutNearbyObjects`, `FreeLook Deoccluder`, `FreeLook on Spherical Surface`, `Impulse Wave`, `Lock-on Target`, `MixingCamera`, `RunningRace`, `SplitScreenCar`, `ThirdPersonWithAimMode`, `ThirdPersonWithRoadieRun`. |
| Input System Samples | Sample scenes illustrating various ways to use Cinemachine with the input system.<br />Includes: `Split Screen Multiplayer`. |

## Simple Player Controller
### Simple Player Controller

Several of the samples make use of of a basic but versatile player controller that you can use in your own projects. Cinemachine's Simple Player Controller is a suite of scripts that can be combined and configured to create character controllers which can be used in different contexts to implement several types of character movement. It is described in more detail [here](SimplePlayerController.md).
Several of the samples listed above make use of Cinemachine's [Simple Player Controller](SimplePlayerController.md), a basic but versatile player controller that you can use in your own projects. It is a suite of scripts that you can combine and configure to create character controllers which you can use in different contexts to implement several types of character movement.

## Tutorials

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Unity.Cinemachine.Samples
/// It is a sample implementation that you can modify or replace with your own. As shipped, it is
/// hardcoded to work specifically with the sample `CameronSimpleController` Animation controller, which
/// is set up with states that the SimplePlayerAnimator knows about. You can modify
/// the this classto work with your own animation controller.
/// this class to work with your own animation controller.
///
/// SimplePlayerAnimator will work with or without a SimplePlayerControllerBase alongside.
/// Without one, it will monitor the transform's position and drive the animation accordingly.
/// SimplePlayerAnimator works with or without a SimplePlayerControllerBase alongside.
/// Without one, it monitors the transform's position and drives the animation accordingly.
/// You can see it used like this in some of the sample scenes, such as RunningRace or ClearShot.
/// In this mode, is it unable to detect the player's grounded state, and so it will always
/// assume the player is grounded.
/// In this mode, is it unable to detect the player's grounded state, and so it always
/// assumes that the player is grounded.
///
/// When a SimplePlayerControllerBase is detected, the SimplePlayerAnimator will install callbacks
/// and expect to be driven by the SimplePlayerControllerBase using the STartJump, EndJump,
/// When a SimplePlayerControllerBase is detected, the SimplePlayerAnimator installs callbacks
/// and expects to be driven by the SimplePlayerControllerBase using the STartJump, EndJump,
/// and PostUpdate callbacks.
/// </summary>
[RequireComponent(typeof(Animator))]
Expand Down Expand Up @@ -84,7 +84,7 @@ virtual protected void LateUpdate()
/// Update the animation based on the player's velocity.
/// Override this to interact appropriately with your animation controller.
/// </summary>
/// <param name="vel">Player's velocity, in player-local coords.</param>
/// <param name="vel">Player's velocity, in player-local coordinates.</param>
/// <param name="jumpAnimationScale">Scale factor to apply to the jump animation.
/// We slow down the jump animation for longer jumps.</param>
virtual protected void UpdateAnimation(Vector3 vel, float jumpAnimationScale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,25 @@ public virtual void SetStrafeMode(bool b) {}
/// - Ground Detection (using raycasts, or delegating to Character Controller)
/// - Camera Override (camera is used only for determining the input frame)
///
/// This behaviour should be attached to the player GameObject's root. It will move the GameObject's
/// This behaviour should be attached to the player GameObject's root. It moves the GameObject's
/// transform. If the GameObject also has a Unity Character Controller component, the Simple Player
/// Controller will delegate grounded state and movement to it. If the GameObject does not have a
/// Character Controller, the Simple Player Controller will manage its own movement and do raycasts
/// Controller delegates grounded state and movement to it. If the GameObject does not have a
/// Character Controller, the Simple Player Controller manages its own movement and does raycasts
/// to test for grounded state.
///
/// Simple Player Controller will do its best to interpret User input in the context of the
/// selected reference frame. Generally, this works well, but in Camera mode, there is the potential
/// that the player may transition from being upright relative to the camera to being inverted.
/// Simple Player Controller does its best to interpret User input in the context of the
/// selected reference frame. Generally, this works well, but in Camera mode, the user
/// may potentially transition from being upright relative to the camera to being inverted.
/// When this happens, there can be a discontinuity in the interpretation of the input.
/// The Simple Player Controller has an ad-hoc technique of resolving this discontinuity,
/// (you will see this in the code), but it is only used in this very specific situation.
/// (you can see this in the code), but it is only used in this very specific situation.
/// </summary>
public class SimplePlayerController : SimplePlayerControllerBase
{
[Tooltip("How long it takes for the player to change velocity or rotation")]
[Tooltip("Transition duration (in seconds) when the player changes velocity or rotation.")]
public float Damping = 0.5f;

[Tooltip("If true, player will strafe when moving sideways, otherwise will turn to face direction of motion")]
[Tooltip("Makes the player strafe when moving sideways, otherwise it turns to face the direction of motion.")]
public bool Strafe = false;

public enum ForwardModes { Camera, Player, World };
Expand All @@ -119,14 +119,14 @@ public enum UpModes { Player, World };
public ForwardModes InputForward = ForwardModes.Camera;

[Tooltip("Up direction for computing motion:\n"
+ "<b>Player</b>: Will move in the Player's local XZ plane.\n"
+ "<b>World</b>: Will move in global XZ plane.")]
+ "<b>Player</b>: Move in the Player's local XZ plane.\n"
+ "<b>World</b>: Move in global XZ plane.")]
public UpModes UpMode = UpModes.World;

[Tooltip("If non-null, take the input frame from this camera instead of Camera.main. Useful for split-screen games.")]
public Camera CameraOverride;

[Tooltip("Raycasts for ground will detect these layers")]
[Tooltip("Layers to include in ground detection via Raycasts.")]
public LayerMask GroundLayers = 1;

[Tooltip("Force of gravity in the down direction (m/s^2)")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ namespace Unity.Cinemachine.Samples
public class SimplePlayerController2D : SimplePlayerControllerBase
{
[Tooltip("Reference to the child object that holds the player's visible geometry. "
+ "'It will be rotated to face the direction of motion")]
+ "'It is rotated to face the direction of motion")]
public Transform PlayerGeometry;

[Tooltip("If true, then it will be possible to influence the direction of motion while the character is "
+ "in the air. Otherwise, the more realistic rule that the feet must be touching the ground will apply.")]
[Tooltip("Makes possible to influence the direction of motion while the character is "
+ "in the air. Otherwise, the more realistic rule that the feet must be touching the ground applies.")]
public bool MotionControlWhileInAir;

bool m_IsSprinting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Unity.Cinemachine.Samples
///
/// Also, when CinemachineCameras are being used to track the character, the
/// [CinemachineBrain](CinemachineBrain.md)'s World Up Override setting should be set to the Player,
/// so that the Camera's Up will match the Player's Up.
/// so that the Camera's Up matches the Player's Up.
/// </summary>
public class SimplePlayerOnSurface : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Unity.Cinemachine.Samples
/// This component manages player shooting. It is expected to be on the player object,
/// or on a child SimplePlayerAimController object of the player.
///
/// If an AimTargetManager is specified, then the behaviour will aim at that target.
/// Otherwise, the behaviour will aim in the forward direction of the player object,
/// If an AimTargetManager is specified, then the behaviour aims at that target.
/// Otherwise, the behaviour aims in the forward direction of the player object,
/// or of the SimplePlayerAimController object if it exists and is not decoupled
/// from the player rotation.
/// </summary>
Expand Down

0 comments on commit f137689

Please sign in to comment.