Hi,i have a cube that is set to trigger but when my third person walk through the trigger my camera zooms in .In the script that i attached to the camera when there is a collider between the player and the camera the camera should zoom in
// check for collision using the true target's desired registration point as set by user using height
RaycastHit collisionHit;
Vector3 trueTargetPosition = new Vector3 (target.position.x, target.position.y + targetHeight, target.position.z);
// if there was a collision, correct the camera position and calculate the corrected distance
bool isCorrected = false;
if (Physics.Linecast (trueTargetPosition, position, out collisionHit, collisionLayers.value))
{
// calculate the distance from the original estimated position to the collision location,
// subtracting out a safety "offset" distance from the object we hit. The offset will help
// keep the camera from being right on top of the surface we hit, which usually shows up as
// the surface geometry getting partially clipped by the camera's front clipping plane.
correctedDistance = Vector3.Distance (trueTargetPosition, collisionHit.point) - offsetFromWall;
isCorrected = true;
}
i already put the camera in ignore raycast layer what can i do so when the player pass throw the collider and the camera doesn't zoom in ?? thanks
Position of the camera before passing throw the trigger
POsition of the camera after passing throw trigger