Hello All,
in anticipation of future collision with and object and his child, I have created this method :
public bool LoadPassenger(UnitScript NewPassenger) {
//we allow to reload existing passenger to reperform the physics action and so, notably at start call.
if((Passenger.Count())
{
foreach(Collider colliHit in NewPassenger.GetComponents())
{
Physics.IgnoreCollision(colliHit,colliChar,true);
}
}
foreach(Transform child in transform)
{
foreach(Collider colliChar in this.GetComponents())
{
foreach(Collider colliHit in NewPassenger.GetComponents())
{
Physics.IgnoreCollision(colliHit,colliChar,true);
}
}
}
//do stuff
NewPassenger.transform.parent=this.transform;
return true;
}
return false;
}
But in game, it returns me this error message.
Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision
The Unitscript got a charactercollider attached onto it, and the parent caller and all his child got a cube collider attached, and I have set theseforeach calls in case one day an object got multiplecolliders.
I have searched a bit around and I do not know what to think.
Thanks for the help.
↧