trace ray
Posted: Sat Sep 17, 2022 12:51 pm
Hello,
I'm using trace ray's to figure out if the player is touching a surface, and if so, return the steepness angle of the surface if its found.
This works as intended, however, since I'm using noblock, this would trigger if the player is standing inside another player. Is it possible to block this scenario, e.g. to setup an ignore other player filter.
I'm using trace ray's to figure out if the player is touching a surface, and if so, return the steepness angle of the surface if its found.
Syntax: Select all
def get_trace_ray(self):
origin = self.origin
destination = Vector(*origin)
destination.z -= 3500
trace = GameTrace()
engine_trace.trace_ray(
Ray(origin, destination, self.mins, self.maxs),
ContentMasks.PLAYER_SOLID_BRUSH_ONLY,
TraceFilterSimple((self.player,)),
trace,
)
trace_plane = None
if trace.did_hit():
destination_distance = trace.end_position.get_distance(origin)
if destination_distance < 0.1:
print("Player is touching a surface!")
trace_plane = trace.plane.normal.z
return trace_plane
This works as intended, however, since I'm using noblock, this would trigger if the player is standing inside another player. Is it possible to block this scenario, e.g. to setup an ignore other player filter.