setElementCollidableWith
Client-side
Server-side
Shared
Pair: isElementCollidableWith
This function can be used to set an element to collide with another element. An element with collisions disabled does not interact physically with the other element. This can be a player, ped, vehicle, object or weapon.
Note
If you want to completely disable an element's collisions, use setElementCollisionsEnabled.
OOP Syntax Help! I don't understand this!
- Method:element:setCollidableWith(...)
Syntax
bool setElementCollidableWith ( element theElement, element withElement, bool enabled )Required Arguments
- theElement: The element which colliding you want to change.
- withElement: The other element you wish the first entity to collide with.
- enabled: A boolean to indicate whether elements should be able to collide with each other (true) or not (false).
Returns
- bool: result
Returns true if the collisions were set succesfully, false otherwise.
Code Examples
client
function ghostmode_on() local playerVehicle = getPedOccupiedVehicle(localPlayer) -- Get the players vehicle if (playerVehicle) then -- Check the return value. for i, v in pairs(getElementsByType("vehicle")) do -- LOOP through all vehicles setElementCollidableWith(v, playerVehicle, false) -- Set the collison off with the other vehicles. end outputChatBox("You are now a Ghost") endendaddCommandHandler("ghostmode", ghostmode_on) -- Add the /ghostmode Command.See Also
Element Functions
- addElementDataSubscriber
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementDataUpdated
- getAttachedElements
- getElementAlpha
- getElementAngularVelocity
- getElementAttachedOffsets
- getElementAttachedTo
- getElementBonePosition
- getElementBoneQuaternionNew
- getElementBoneRotation
- getElementBoundingBox
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getElementDimension
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementHealth
- getElementID
- getElementInterior
- getElementLighting
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRadius
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getLowLODElement
- getRootElement
- hasElementData
- hasElementDataSubscriber
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementCollidableWith
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLocal
- isElementLowLOD
- isElementOnFireNew
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementVisibleTo
- isElementWaitingForGroundToLoad
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- removeElementDataSubscriber
- setElementAlpha
- setElementAngularVelocity
- setElementAttachedOffsets
- setElementBonePosition
- setElementBoneQuaternionNew
- setElementBoneRotation
- setElementCallPropagationEnabled
- setElementCollidableWith
- setElementCollisionsEnabled
- setElementDataUpdated
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementLightingNew
- setElementMatrix
- setElementModel
- setElementOnFireNew
- setElementParent
- setElementPosition
- setElementRotation
- setElementStreamable
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement
- updateElementRpHAnim
Element Events
- onClientElementColShapeHit
- onClientElementColShapeLeave
- onClientElementDataChange
- onClientElementDestroy
- onClientElementDimensionChange
- onClientElementInteriorChange
- onClientElementModelChange
- onClientElementStreamIn
- onClientElementStreamOut
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync