3D Trigger collider slows player moved by forces
Hi, i have this monkey being moving by forces, but randomly he slown down (it looks like some kind of friction with the ground) , i noticed that this is caused by two trigger colliders (used to detect levers, chests and enemies ) because when i move these colliders position or i change any value of they , the monkey returns to its default speed, It happens Sometimes when i initialize the game, please help and excuse my english
these colliders have this ontrigger event asociated
First collider (detector)
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag=="enemy")
{
if(!lista.Contains(other.gameObject))
{
lista.Add(other.gameObject);
}
}
}
Second collider (mini detector)
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag=="palanca")
{
palanca= other.gameObject.GetComponent<Palanca>();
}
if(other.gameObject.tag=="cofre")
{
cofre= other.gameObject.GetComponent<cofres>();
}
}
void OnTriggerStay(Collider other)
{
if(other.gameObject.tag=="palanca")
{
palanca= other.gameObject.GetComponent<Palanca>();
}
if(other.gameObject.tag=="cofre")
{
cofre= other.gameObject.GetComponent<cofres>();
}
}
void OnTriggerExit(Collider other)
{
palanca=null;
cofre=null;
}
The moving script has this code for each key (wasd)
if(Input.GetKey("a"))) //rb =rigidBody
{
rb.AddForce(-transform.right*15,ForceMode.VelocityChange); }
asdasdasd.png
(61.4 kB)
asdasdffffasd.png
(91.1 kB)
Comment