Skip to content
QueryUtil

Utils / QueryUtil

QueryUtil Class

Radiographic detect tools

Table of contents

Methods

boxOverlap(boxCenter: Vector, boxExtent: Vector, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, source?: GameObject): GameObject[] other
Rectangular range detection
boxTrace(start: Vector, end: Vector, halfSize: Vector, orientation: Rotation, multiTrace?: boolean, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, source?: GameObject): HitResult[] other
Box body radiographic testing
capsuleOverlap(capsuleCenter: Vector, radius: number, halfHeight: number, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, source?: GameObject): GameObject[] other
Capsule body range detect
capsuleTrace(start: Vector, end: Vector, radius: number, halfHeight: number, multiTrace?: boolean, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, source?: GameObject): HitResult[] other
Radiographic detect of capsule body
lineTrace(start: Vector, end: Vector, multiTrace?: boolean, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, traceSkeletonOnly?: boolean, source?: GameObject): HitResult[] other
Radiographic testing
sphereOverlap(sphereCenter: Vector, sphereRadius: number, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, source?: GameObject): GameObject[] other
Spherical range detect
sphereTrace(start: Vector, end: Vector, radius: number, multiTrace?: boolean, drawDebug?: boolean, objectsToIgnore?: string[], ignoreByType?: boolean, source?: GameObject): HitResult[] other
Spherical radiographic testing

Methods

boxOverlap

Static boxOverlap(boxCenter, boxExtent, drawDebug?, objectsToIgnore?, ignoreByType?, source?): GameObject[] other

Rectangular range detection

Parameters

boxCenter VectorUsage: Center position of rectangle
boxExtent VectorUsage: Size of the box body
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object's UUID array default: [] range: Unrestricted
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

GameObject[]GameObject array

Usage example: The following example shows the basic process of using rectangle range detect

ts
const goList = QueryUtil.boxOverlap(new mw.Vector(0,0,0), new mw.Vector(1000,0,0), true);
for (const item of goList) {
    // item: Detect Objects
}
const goList = QueryUtil.boxOverlap(new mw.Vector(0,0,0), new mw.Vector(1000,0,0), true);
for (const item of goList) {
    // item: Detect Objects
}

boxTrace

Static boxTrace(start, end, halfSize, orientation, multiTrace?, drawDebug?, objectsToIgnore?, ignoreByType?, source?): HitResult[] other

Box body radiographic testing

Parameters

start VectorUsage: start position
end VectorUsage: End position
halfSize VectorUsage: Box half length, width, and height
orientation RotationUsage: Box orientation
multiTrace? booleanUsage: Whether to penetrate detect default: false
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object guided array default: [] range: No restrictions
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

HitResult[]HitResult array

Usage example: The following example shows the basic process of using box ray detect

ts
const ResultList = QueryUtil.boxTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), new mw.Vector(10,10,10), new mw.Rotation(0,0,0), true, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}
const ResultList = QueryUtil.boxTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), new mw.Vector(10,10,10), new mw.Rotation(0,0,0), true, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}

capsuleOverlap

Static capsuleOverlap(capsuleCenter, radius, halfHeight, drawDebug?, objectsToIgnore?, ignoreByType?, source?): GameObject[] other

Capsule body range detect

Parameters

capsuleCenter VectorUsage: Center position of capsule body
radius numberUsage: Capsule body radius range: No restrictions, but please use an appropriate radius scale. Type: Floating point type
halfHeight numberUsage: Half height range of capsule body: No limit, but please use an appropriate scale. Type: Floating point type
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object's UUID array default: [] range: Unrestricted
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

GameObject[]GameObject array

Usage example: The following example shows the basic process of using cylinder range detect

ts
const ResultList = QueryUtil.capsuleOverlap(new mw.Vector(0,0,0), 100, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}
const ResultList = QueryUtil.capsuleOverlap(new mw.Vector(0,0,0), 100, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}

capsuleTrace

Static capsuleTrace(start, end, radius, halfHeight, multiTrace?, drawDebug?, objectsToIgnore?, ignoreByType?, source?): HitResult[] other

Radiographic detect of capsule body

Parameters

start VectorUsage: start position
end VectorUsage: End position
radius numberUsage: Capsule body radius range: No restrictions, but please use an appropriate radius scale. Type: Floating point type
halfHeight numberUsage: Half height range of capsule body: No limit, but please use an appropriate scale. Type: Floating point type
multiTrace? booleanUsage: Whether to penetrate detect default: false
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object guided array default: [] range: No restrictions
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

HitResult[]HitResult array

Usage example: The following example demonstrates the basic process of using capsule body X-ray detection

ts
const ResultList = QueryUtil.capsuleTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), 5, 10, true, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}
const ResultList = QueryUtil.capsuleTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), 5, 10, true, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}

lineTrace

Static lineTrace(start, end, multiTrace?, drawDebug?, objectsToIgnore?, ignoreByType?, traceSkeletonOnly?, source?): HitResult[] other

Radiographic testing

Parameters

start VectorUsage: start position
end VectorUsage: End position
multiTrace? booleanUsage: Whether to penetrate detect default: false
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object guided array default: [] range: No restrictions
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
traceSkeletonOnly? booleanUsage: whether to perform detect on specific parts default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

HitResult[]HitResult array

Usage example: The following example demonstrates the basic process of using radiographic testing

ts
const ResultList = QueryUtil.lineTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), true, false, [], false, gameObject, false);
for (const item of ResultList) {
    // item: Detect Objects
}
const ResultList = QueryUtil.lineTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), true, false, [], false, gameObject, false);
for (const item of ResultList) {
    // item: Detect Objects
}

sphereOverlap

Static sphereOverlap(sphereCenter, sphereRadius, drawDebug?, objectsToIgnore?, ignoreByType?, source?): GameObject[] other

Spherical range detect

Parameters

sphereCenter VectorUsage: Center position of sphere
sphereRadius numberUsage: Sphere radius range: No restrictions, but please use an appropriate radius scale. Type: Floating point type
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object's UUID array default: [] range: Unrestricted
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

GameObject[]GameObject array

Usage example: The following example shows the basic process of detect using spherical range

ts
const ResultList = QueryUtil.sphereOverlap(new mw.Vector(0,0,0), 100, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}
const ResultList = QueryUtil.sphereOverlap(new mw.Vector(0,0,0), 100, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}

sphereTrace

Static sphereTrace(start, end, radius, multiTrace?, drawDebug?, objectsToIgnore?, ignoreByType?, source?): HitResult[] other

Spherical radiographic testing

Parameters

start VectorUsage: start position
end VectorUsage: End position
radius numberUsage: Sphere radius range: [0,+∞] However, please use an appropriate radius scale. Type: Floating point type
multiTrace? booleanUsage: Whether to penetrate detect default: false
drawDebug? booleanUsage: Visualize drawing default: false
objectsToIgnore? string[]Usage: Block object guided array default: [] range: No restrictions
ignoreByType? booleanUsage: Do you want to block based on the type of the incoming object? Default: false
source? GameObjectUsage: Object initiating detection (detection source does not participate in detection) default: null

Returns

HitResult[]HitResult array

Usage example: The following example shows the basic process of using sphere ray detect

ts
const ResultList = QueryUtil.sphereTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), 5, true, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}
const ResultList = QueryUtil.sphereTrace(new mw.Vector(0,0,0), new mw.Vector(300,0,0), 5, true, false, [], false, gameObject);
for (const item of ResultList) {
    // item: Detect Objects
}