diff options
author | Chris Bradfield <chris@kidscancode.org> | 2022-02-21 14:08:57 -0800 |
---|---|---|
committer | Chris Bradfield <chris@kidscancode.org> | 2022-02-22 23:31:33 -0800 |
commit | 849d34ba8ec6e46d449c7229fff2343062cf1667 (patch) | |
tree | dedfee860707fa93213be0e2557f54d95ad361d0 /modules/mono/editor_templates/CharacterBody3D | |
parent | 256069eaf00be2340259f896695014d92b1e22ed (diff) |
Rename motion_velocity to velocity
Diffstat (limited to 'modules/mono/editor_templates/CharacterBody3D')
-rw-r--r-- | modules/mono/editor_templates/CharacterBody3D/basic_movement.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/mono/editor_templates/CharacterBody3D/basic_movement.cs b/modules/mono/editor_templates/CharacterBody3D/basic_movement.cs index d8c2f67ac8..a6935fe497 100644 --- a/modules/mono/editor_templates/CharacterBody3D/basic_movement.cs +++ b/modules/mono/editor_templates/CharacterBody3D/basic_movement.cs @@ -13,15 +13,15 @@ public partial class _CLASS_ : _BASE_ public override void _PhysicsProcess(float delta) { - Vector3 motionVelocity = MotionVelocity; + Vector3 velocity = Velocity; // Add the gravity. if (!IsOnFloor()) - motionVelocity.y -= gravity * delta; + velocity.y -= gravity * delta; // Handle Jump. if (Input.IsActionJustPressed("ui_accept") && IsOnFloor()) - motionVelocity.y = JumpVelocity; + velocity.y = JumpVelocity; // Get the input direction and handle the movement/deceleration. // As good practice, you should replace UI actions with custom gameplay actions. @@ -29,16 +29,16 @@ public partial class _CLASS_ : _BASE_ Vector3 direction = Transform.basis.Xform(new Vector3(inputDir.x, 0, inputDir.y)).Normalized(); if (direction != Vector3.Zero) { - motionVelocity.x = direction.x * Speed; - motionVelocity.z = direction.z * Speed; + velocity.x = direction.x * Speed; + velocity.z = direction.z * Speed; } else { - motionVelocity.x = Mathf.MoveToward(MotionVelocity.x, 0, Speed); - motionVelocity.z = Mathf.MoveToward(MotionVelocity.z, 0, Speed); + velocity.x = Mathf.MoveToward(Velocity.x, 0, Speed); + velocity.z = Mathf.MoveToward(Velocity.z, 0, Speed); } - MotionVelocity = motionVelocity; + Velocity = velocity; MoveAndSlide(); } } |