using Godot; using System.Collections; using System.Collections.Generic; namespace Rokojori { public class CollisionData { public bool hasCollision = false; public Node collider; public Vector3 normal; public Vector3 position; public Shape3D shape; public Rid rid; public void Get( PhysicsRayQueryParameters3D ray, PhysicsDirectSpaceState3D physicsState ) { var result = physicsState.IntersectRay( ray ); if ( ! result.ContainsKey( "collider" ) ) { hasCollision = false; return; } hasCollision = true; collider = result[ "collider" ].As(); normal = result[ "normal" ].AsVector3(); position = result[ "position" ].AsVector3(); shape = result[ "shape" ].As(); rid = result[ "rid" ].AsRid(); // RJLog.Log( "Has Collision:", HierarchyName.Of( collider ), ">> at position:", position, "with normal:", normal ); } } }