Example #1
0
    // FIXME - increase max number of results
    // this has a max number of results that get filled with static bodies...
    public Godot.Collections.Array FindRadius(KinematicBody body, float radius)
    {
        // test for radius
        SphereShape s = new SphereShape();

        s.Radius = radius;

        // Get space and state of the subject body
        RID space = PhysicsServer.BodyGetSpace(body.GetRid());
        PhysicsDirectSpaceState state = PhysicsServer.SpaceGetDirectState(space);

        // Setup shape query parameters
        PhysicsShapeQueryParameters par = new PhysicsShapeQueryParameters();

        par.ShapeRid  = s.GetRid();
        par.Transform = body.Transform;

        return(state.IntersectShape(par, 100));
    }