i want to edit default property of CharacterController because i want to make it cubic in shape , not sphare(which is default).
or alternatively you can say that i want to make my own class which should have some property similar to CharacterController (i.e : CharacterController .SimpleMove)
Please help me out…
The Character Controller uses a Capsule collider, and this cannot be changed - you may change the radius and height and make it an sphere, but there’s no way to use other collider shape.
If another kind of collider is needed, you may try a rigidbody character. Set rigidbody.freezeRotation = true; at Start, and use rigidbody.velocity = movDir; instead of character.SimpleMove(movDir) at FixedUpdate. You can let Use Gravity set, and get gravity action for free:
function Start(){ rigidbody.freezeRotation = true; } var speed = 8.0; var movDir = Vector3.zero; function FixedUpdate(){ movDir = Vector3(Input.GetAxis("Horizontal")*speed, rigidbody.velocity.y, Input.GetAxis("Vertical")*speed); rigidbody.velocity = movDir; }
You could cut out parts of the script and piece together a new script that could be applied to any object in the game. Would be your best bet. Either that or google “Unity FPS script” or something like that, and you’ll likely find what you’re looking for.