hi, i need help with my game, i got this problem when my character dash forward it pass thru to any objects with collider on it but when im not dashing and just walking around it works fine and im not passing thru to any object (hope u get what i mean with this, im not english guy). Here’s my script
If you’re using CharacterController, then you should be using Move() or SimpleMove() to move, not translating the transform. You may need to increase the Skin Width of the controller too.
It is because you force the Rigidbody to not take physics into account when you use Translate. If you want to add extra force in some direction try using AddForce() instead.
i have solve the problem, this should be fine, tnx for the help warwick alison! this script also works perfectly with third person controller script or just create new javascript and attach this.
public var dashDistance : float = 25.0;
private var counter = 0;
private var isDashing = false;
function Update()
{
var controller : CharacterController = GetComponent(CharacterController);
if(Input.GetButtonDown ("Dash"))
{
isDashing = true;
}
if(isDashing){
var forward : Vector3 = transform.TransformDirection(Vector3.forward);
var curSpeed : float = 3 * dashDistance;
controller.SimpleMove(forward * curSpeed);
counter++;
}
if(counter > 15){
isDashing = false;
counter = 0;
}
}