SetElementCollidableWith
From Multi Theft Auto: Wiki
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.
Note: You can only use this function with the element types listed below.
Syntax
bool setElementCollidableWith ( element theElement, element withElement, bool enabled )
OOP Syntax Help! I don't understand this!
- Method: element:setCollidableWith(...)
- Counterpart: isElementCollidableWith
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 eachother (true) or not (false)
Returns
Returns true if the collisions were set succesfully, false otherwise.
Example
Click to collapse [-]
Clientfunction ghostmode_on() local v = getPedOccupiedVehicle(localPlayer) -- Get her's Vehicle ID for index,vehicle in ipairs(getElementsByType("vehicle")) do --LOOP through all Vehicles setElementCollidableWith(vehicle, v, false) -- Set the Collison off with the Other vehicles. end outputChatBox("You are now a Ghost :P",thePlayer) end addCommandHandler("ghostmode", ghostmode_on) -- Add the /ghostmode Command.
See Also
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementBoundingBox
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementColShape
- getElementCollisionsEnabled
- getElementData
- getElementDimension
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRadius
- getElementRotation
- getElementType
- getElementVelocity
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementCollidableWith
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLocal
- isElementLowLOD
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- isElementWithinColShape
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollidableWith
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementMatrix
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementStreamable
- setElementVelocity
- setLowLODElement