mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add new function testSphereAgainstWorld (Close #646)

Open FileEX opened this issue 1 year ago • 6 comments

This PR adds a new function testSphereAgainstWorld, which allows checking if there are any obstacles within a given radius.

Syntax

bool hit, element hitElement, int modelID, float elementPositionX, float elementPositionY, float elementPositionZ, float elementRotationX, float elementRotationY, float elementRotationZ, int lodID, string type = testSphereAgainstWorld(float x, float y, float z, float radius [, element ignoredElement = nil, bool checkBuildings = true, checkVehicles = true, checkPeds = true, checkObjects = true, checkDummies = true, ignoreSomeObjectsForCamera = false ] )

hit - Indicates whether a collision was detected. hitElement - The element that was detected. If it wasn't created in MTA, it will be nil. elementPositionX, elementPositionY, elementPositionZ - World position of the detected element elementRotationX, elementRotationY, elementRotationZ - World rotation of the element modelID - The ID of the element. lodID - The ID of the element's LOD (or 0). entityType - The type of the element (building, vehicle, ped, object, dummy)

The modelID, lodID, and entityType parameters are returned even if hitElement is nil.

Closes #646

FileEX avatar Oct 10 '24 22:10 FileEX