- Home /
Question by
rahim_jessani · Sep 14, 2016 at 12:27 PM ·
unity 5rigidbodycharactercontrollercollision detectionstandard-assets
Character not moving on slopes
hey peoples, i am using unity standard asset AI Character Control asset but i am facing some problems with that. Basically the problem is when i am trying my character to move on the slopes it just ignore that and passes the collider even without getting stoped. the codes i am using are listed below :
private void FixedUpdate()
{
if (target != null)
{
if (current_pos_id < target.Count)
{
agent.SetDestination(target[current_pos_id].position);
}
else
character.Move(Vector3.zero, false, false);
}
if (agent.remainingDistance > agent.stoppingDistance)
{
character.Move(agent.desiredVelocity, false, false);
}
else
{
if(character.transform.position.y != target[current_pos_id].position.y)
{
character.transform.position = new Vector3(character.transform.position.x, target[current_pos_id].position.y, character.transform.position.z);
}
Debug.Log("character " +character.transform.position);
Debug.Log("ideal "+target[current_pos_id].position);
current_pos_id++;
}
}
can anyone help to solve this problem Thankyou
Comment
Answer by BossRomulo · Mar 11, 2021 at 02:12 AM
What method of movement are you using.
Is it rigidbody,character controller, custom character controller.
if its character controller then edit the slope settings in the inspector.
if rigidbody then you will have to code it.