Added skinned mesh collider. Changed Heat Reset from list to event action. Added curve to heat buildup
This commit is contained in:
@@ -9,7 +9,9 @@ public class EyeTrackingCollisionPoints : MonoBehaviour
|
||||
private float rayDistance = 1.0f;
|
||||
|
||||
[SerializeField]
|
||||
private LayerMask layersToInclude;
|
||||
private LayerMask gazableLayers;
|
||||
[SerializeField]
|
||||
private LayerMask targetLayers;
|
||||
|
||||
public GameObject hitPointPrefab;
|
||||
|
||||
@@ -21,15 +23,10 @@ public class EyeTrackingCollisionPoints : MonoBehaviour
|
||||
|
||||
Vector3 rayCastDirection = transform.TransformDirection(Vector3.forward) * rayDistance;
|
||||
|
||||
if ( hitPoint != null && Physics.Raycast(transform.position, rayCastDirection, out hit, rayDistance, layersToInclude))
|
||||
if ( hitPoint != null && Physics.Raycast(transform.position, rayCastDirection, out hit, rayDistance, gazableLayers))
|
||||
{
|
||||
hitPoint.transform.position = new Vector3(hit.point.x, hit.point.y, hit.point.z);
|
||||
|
||||
GameObject hitObject = hit.collider.gameObject;
|
||||
if ( hitObject.GetComponent<RecieveHeat>() != null)
|
||||
{
|
||||
hitObject.GetComponent<RecieveHeat>().AddHeat(0.02f);
|
||||
}
|
||||
FindVisibleTargets(hitPoint.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +35,22 @@ public class EyeTrackingCollisionPoints : MonoBehaviour
|
||||
hitPoint = Instantiate(hitPointPrefab);
|
||||
return hitPoint.transform;
|
||||
}
|
||||
|
||||
void FindVisibleTargets(Vector3 hitPosition) // Sucht in einem Radius von 20 cm um den HitPoint nach Targets
|
||||
{
|
||||
Collider[] visibleTargets = Physics.OverlapSphere(hitPosition, 0.2f, targetLayers);
|
||||
foreach (Collider col in visibleTargets)
|
||||
{
|
||||
GameObject hitObject = col.gameObject;
|
||||
if (hitObject.GetComponent<RecieveHeat>() != null)
|
||||
{
|
||||
hitObject.GetComponent<RecieveHeat>().AddHeat(0.02f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Hit " + hitObject.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user