HU/isElementWithinColShape
This function is used to determine if an element is within a collision shape. Please note that for legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move. Please also note that before 1.0.3, this did not function correctly when moving a colshape.
Please note that this function doesn't verify whether element is in the same dimension and interior, additional checks could be implemented manually if they are needed.
Szintaxis
bool isElementWithinColShape ( element theElement, colshape theShape )
OOP Syntax Help! I don't understand this!
- Method: element:isWithinColShape(...)
Kötelező paraméterek
Visszatérési érték
Visszatérési értéke true, ha az elem a colshape-n belül van, egyébként false
Példa
This small script is an example of detecting if a player is within a certain defined colshape. This could serve as a base to perform many functions, rather than just an output.
local circlearea = createColCircle ( 0, 0, 10 ) function ColShapeHit ( thePlayer, matchingDimension ) local detection = isElementWithinColShape ( thePlayer, circlearea ) --A variable called 'detection' stores the result of asking if the player --who entered a colshape is within the specific colshape called 'circlearea'. --The result is either true or false. detection = detection and getElementDimension( thePlayer ) == getElementDimension( circlearea ) --Let's additionally check element dimensions. if detection then outputChatBox ( getPlayerName(thePlayer).." is in the 'circle area' col shape" ) end --if detection was true then the player is in the col shape. Output a --message to confirm this end addEventHandler ( "onColShapeHit", root, ColShapeHit )
Lásd még
- HU/attachElements
- HU/clearElementVisibleTo
- HU/cloneElement
- HU/createElement
- HU/destroyElement
- HU/detachElements
- HU/getAllElementData
- HU/getAttachedElements
- HU/getElementAlpha
- HU/getElementAttachedOffsets
- HU/getElementAttachedTo
- HU/getElementCollisionsEnabled
- HU/getElementByID
- HU/getElementByIndex
- HU/getElementChild
- HU/getElementChildren
- HU/getElementChildrenCount
- HU/getElementColShape
- HU/getElementData
- HU/getElementDimension
- HU/getElementHealth
- HU/getElementID
- HU/getElementInterior
- HU/getElementMatrix
- HU/getElementModel
- HU/getElementParent
- HU/getElementPosition
- HU/getElementRotation
- HU/getElementSyncer
- HU/getElementType
- HU/getElementVelocity
- HU/getElementZoneName
- HU/getElementsByType
- HU/getElementsWithinColShape
- HU/getLowLODElement
- HU/getRootElement
- HU/isElement
- HU/isElementAttached
- HU/isElementCallPropagationEnabled
- HU/isElementDoubleSided
- HU/isElementFrozen
- HU/isElementInWater
- HU/isElementLowLOD
- HU/isElementVisibleTo
- HU/isElementWithinColShape
- HU/isElementWithinMarker
- HU/removeElementData
- HU/setElementAlpha
- HU/setElementAngularVelocity
- HU/getElementAngularVelocity
- HU/setElementAttachedOffsets
- HU/setElementCallPropagationEnabled
- HU/setElementCollisionsEnabled
- HU/setElementData
- HU/setElementDimension
- HU/setElementDoubleSided
- HU/setElementFrozen
- HU/setElementHealth
- HU/setElementID
- HU/setElementInterior
- HU/setElementModel
- HU/setElementParent
- HU/setElementPosition
- HU/setElementRotation
- HU/setElementSyncer
- HU/setElementVelocity
- HU/setElementVisibleTo
- HU/setLowLODElement