First-person player controller made in C# for the Unity game engine.
As of the initial release date, it includes:
- Player movement
- Camera movement
- Jumping
A toggle in the editor is included that can be switched accordingly if you want input processing/smoothing or raw movement (for both the camera and player movement)
Crouching may be added soon.
Ideally, the player hierarchy should look like this:
Player
is an empty parent, containing both the Rigidbody, and the controller script.
PlayerObj
is simply the visual of the player, e.g. a prefab or a capsule.
PlayerCam
is the camera the player utilizes. It should be the only camera enabled in your scene.
GroundCheck
is the position where the raycast to check if the player can jump is positioned. It should be at the bottom of your player object, but there should be no gap between it and the object.
Copyright 2023 Om Rawaley (@omrawaley)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Redistribution and modification is permitted as long as you abide by the redistribution terms
- The author or license cannot be held liable for any damage caused by the software
- Must include a copy of the license and original copyright notice when redistributing
- Must state all changes made to the software when distributing