Hi, I'm trying to detect the collision between a line renderer and a sensor which is a subpart of a player (FPS). Indeed, the sensor moves with the player, so i must put it inside the Main Camera.
If the "player" is already in the scene without any script, it works, but if it's a real player who was connected via the network with scripts as Character Controller and so on, I can only detect the object "Player", and not the subpart "Sensor".
I've tried some things as layers, but I always have that collision with "Player".
Any idea about what is the best way to deal with that ?
This is my code for now :
if(Physics.Raycast(Camera.main.transform.position,ray.direction,hit)
Debug.Log(hit.collider.tag) // Always print 'Player'
if (hit.collider.tag == "FrontSensor") {
...
}
if (hit.collider.tag == "BackSensor") {
}
}