Creating a Character Collider Script

Im new to Unity and fairly new to Javascript. I am creating a game that uses a movement and camera system similar to Xenogears, and I have the character movement script and the camera script working correctly. However, I have scripted the player character’s movement to be effected by other objects in the scene. Im looking make it stand on the ground and not pass through walls and buildings.

I was wondering what the best way to go about this is. Im not sure how difficult writing a script from scratch would be. I see my options being to write a completely new script to handle it, to take pieces from the provided 3rd person character controller script and add them to my current script, or to go into the provided character controller script and edit its movement to operate like the script I’ve written.

The problem with all of these is that Im not experienced enough with javascript to be able to fully follow whats happening in the provided 3rd person character controller script. I have been learning the scripting needed as I go along form online tutorials and am having a hard time finding any that relate to the way the collider system in Unity works.

So far the script I have rotates the character in the direction of the arrow keys and then moves him forward. Up moves north (0 degrees), Up and left moves northwest (45 degrees) and so on.

Any help or advice would be appreciated. Thanks.

EDITED: So I checked out the character controller, and realized I can pass all of the movement scripting through it and get the same results as adding the scripting directly through the prefab, so I feel like this solves most of my issues. The only question I have left is how to make the character controller actually work? Like the scripts I use to make the character controller respond to other objects.

The CharacterController is usually the best solution for characters, unless you need them walking on the walls or upside down - the CharacterController is always upright.

You can rotate left/right your CharacterController with Transform methods like Rotate, but must always move it using SimpleMove or Move: SimpleMove takes a Vector3 indicating the velocity and automatically applies gravity, but can’t jump or fly (the velocity.y component is ignored); Move takes a Vector3 indicating the displacement (equivalent to Transform.Translate), and everything is in your hands (gravity, jumping, flying etc.)

There are good example scripts in SimpleMove and 2 - the first one rotates with AD and moves forth/back with WS, and the second moves left/right/forth/back with ADWS. Both are simple scripts, and can be modified to suit your needs.