The IgnoreGameObject
method is used to exclude a specific GameObject
from being hit during a scene trace. This is useful when you want to perform a trace but need to ignore certain objects that might otherwise interfere with the trace results.
The IgnoreGameObject
method is used to exclude a specific GameObject
from being hit during a scene trace. This is useful when you want to perform a trace but need to ignore certain objects that might otherwise interfere with the trace results.
To use the IgnoreGameObject
method, call it on an instance of SceneTrace
and pass the GameObject
you wish to ignore as a parameter. This method returns the SceneTrace
instance, allowing for method chaining.
// Example of using IgnoreGameObject SceneTrace trace = new SceneTrace(); GameObject objectToIgnore = ...; // Obtain the GameObject reference trace.IgnoreGameObject(objectToIgnore); // Continue setting up the trace trace.FromTo(startPosition, endPosition); SceneTraceResult result = trace.Run(); // Process the result if (result.Hit) { // Handle the hit }