I’ve a difficulty with my character controller. I am utilizing a raycast from the enemy AI as a line of sight in an effort to begin following the participant. My subject is that with my present character controller collider offset the raycast will not work. Once I zero out the character controlle’rs heart all is nicely however, I do not need that since my character is hovering of kinds so if I zero it out it stands bellow it. Can I get some suggestions of what to do in an effort to repair that?
That is my CheckLineOfSight
perform:
non-public bool CheckLineOfSight(DummyChar participant)
{
Vector3 Route = (participant.remodel.place - remodel.place).normalized;
float DotProduct = Vector3.Dot(remodel.ahead, Route);
if (DotProduct >= Mathf.Cos(FieldOfView))
{
Debug.Log("Can begin checking for participant Ray " + Route);
RaycastHit Hit;
if (Physics.Raycast(remodel.place, Route, out Hit, Collider.radius, LineOfSightLayers))
{
Debug.Log("hited " + Hit.collider.identify);
if (participant!= null)
{
Debug.Log("Discovered goal");
OnGainSight?.Invoke(participant);
return true;
}
}
}
return false;
}
As I discussed, through the use of a dummy character with the character controller in default values, the enemy does see the participant because it reaches its line of sight and does go in direction of him, however with my precise participant that has its character controller heart offset it doesn’t see it.
Edit : right here is the inspector view of the controller and participant remodel
Though i simply realized i’d be capable of actually zero issues out by inserting the mesh into a toddler as an alternative of the basis