IsElementWithinColShape: Difference between revisions
Jump to navigation
Jump to search
m (Corrected addEventHandler call) |
No edit summary |
||
Line 1: | Line 1: | ||
{{Server client function}} | |||
__NOTOC__ | __NOTOC__ | ||
This function is used to | This function is used to determine if an element is within a collision shape. | ||
==Syntax== | ==Syntax== | ||
Line 15: | Line 16: | ||
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. | 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. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function ColShapeHit ( | function ColShapeHit ( thePlayer, matchingDimension ) | ||
detection = isElementWithinColShape ( | detection = isElementWithinColShape ( thePlayer, circlearea ) | ||
--A variable called 'detection' stores the result of asking if the player | --A variable called 'detection' stores the result of asking if the player | ||
--who entered a colshape is within the specific colshape called 'circlearea'. | --who entered a colshape is within the specific colshape called 'circlearea'. |
Revision as of 14:32, 17 August 2007
This function is used to determine if an element is within a collision shape.
Syntax
bool isElementWithinColShape ( element theElement, colshape theShape )
Required Arguments
Returns
Returns true if the element is within the colshape, false otherwise
Example
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.
function ColShapeHit ( thePlayer, matchingDimension ) 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. if detection == true then outputChatBox ( "Player 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", getRootElement(), ColShapeHit )
See Also
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement