GetColShapeType: Difference between revisions
Jump to navigation
Jump to search
CrosRoad95 (talk | contribs) (typo) |
(→Syntax) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Server client function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3.0156|1.5.5| | {{New feature/item|3.0156|1.5.5|12286|This function is used to retrieve the type of an colshape.}} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int getColShapeType ( colshape shape ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[colshape]]:getShapeType|shapeType|}} | {{OOP||[[colshape]]:getShapeType|shapeType|}} | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''shape:''' The [[colshape]] you wish to get the type of. | ||
===Returns=== | ===Returns=== | ||
Returns | Returns ''false'' if invalid arguments were passed, or an [[int]]eger of the type of the colshape, which include: | ||
*'''0:''' circle | |||
*'''1:''' cuboid | |||
*'''2:''' sphere | |||
*'''3:''' rectangle | |||
*'''4:''' polygon | |||
*'''5:''' tube | |||
==Example== | ==Example== | ||
This example outputs the type of all colshapes. | |||
This example | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local circle = createColCircle(0,0,1) | local circle = createColCircle(0, 0, 1) | ||
local cubboid = createColCuboid(0,0,0,0,0,0) | local cubboid = createColCuboid(0, 0, 0, 0, 0, 0) | ||
local sphere = createColSphere(0,0,0,0) | local sphere = createColSphere(0, 0, 0, 0) | ||
local rectangle = createColRectangle(0,0,0,0) | local rectangle = createColRectangle(0, 0, 0, 0) | ||
local polygon = createColPolygon(0,0,0,0,0,0,0,0) | local polygon = createColPolygon(0, 0, 0, 0, 0, 0, 0, 0) | ||
local tube = createColTube(0,0,0,0,0) | local tube = createColTube(0, 0, 0, 0, 0) | ||
iprint("circle",getColShapeType(circle), circle:getShapeType(), circle.shapeType) | iprint("circle", getColShapeType(circle), circle:getShapeType(), circle.shapeType) | ||
iprint("cubboid",getColShapeType(cubboid), cubboid:getShapeType(), cubboid.shapeType) | iprint("cubboid", getColShapeType(cubboid), cubboid:getShapeType(), cubboid.shapeType) | ||
iprint("sphere",getColShapeType(sphere), sphere:getShapeType(), sphere.shapeType) | iprint("sphere", getColShapeType(sphere), sphere:getShapeType(), sphere.shapeType) | ||
iprint("rectangle",getColShapeType(rectangle), rectangle:getShapeType(), rectangle.shapeType) | iprint("rectangle", getColShapeType(rectangle), rectangle:getShapeType(), rectangle.shapeType) | ||
iprint("polygon",getColShapeType(polygon), polygon:getShapeType(), polygon.shapeType) | iprint("polygon", getColShapeType(polygon), polygon:getShapeType(), polygon.shapeType) | ||
iprint("tube",getColShapeType(tube), tube:getShapeType(), tube.shapeType) | iprint("tube", getColShapeType(tube), tube:getShapeType(), tube.shapeType) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Collision_shape_functions}} | ||
[[hu:getColShapeType]] |
Latest revision as of 09:41, 22 June 2019
This function is used to retrieve the type of an colshape.
Syntax
int getColShapeType ( colshape shape )
OOP Syntax Help! I don't understand this!
- Method: colshape:getShapeType(...)
- Variable: .shapeType
Required Arguments
- shape: The colshape you wish to get the type of.
Returns
Returns false if invalid arguments were passed, or an integer of the type of the colshape, which include:
- 0: circle
- 1: cuboid
- 2: sphere
- 3: rectangle
- 4: polygon
- 5: tube
Example
This example outputs the type of all colshapes.
local circle = createColCircle(0, 0, 1) local cubboid = createColCuboid(0, 0, 0, 0, 0, 0) local sphere = createColSphere(0, 0, 0, 0) local rectangle = createColRectangle(0, 0, 0, 0) local polygon = createColPolygon(0, 0, 0, 0, 0, 0, 0, 0) local tube = createColTube(0, 0, 0, 0, 0) iprint("circle", getColShapeType(circle), circle:getShapeType(), circle.shapeType) iprint("cubboid", getColShapeType(cubboid), cubboid:getShapeType(), cubboid.shapeType) iprint("sphere", getColShapeType(sphere), sphere:getShapeType(), sphere.shapeType) iprint("rectangle", getColShapeType(rectangle), rectangle:getShapeType(), rectangle.shapeType) iprint("polygon", getColShapeType(polygon), polygon:getShapeType(), polygon.shapeType) iprint("tube", getColShapeType(tube), tube:getShapeType(), tube.shapeType)
See Also
- addColPolygonPoint
- createColCircle
- createColCuboid
- createColPolygon
- createColRectangle
- createColSphere
- createColTube
- getColPolygonHeight
- getColPolygonPoints
- getColPolygonPointPosition
- getColShapeType
- getColShapeRadius
- getColShapeSize
- getElementColShape
- getElementsWithinColShape
- isElementWithinColShape
- isInsideColShape
- removeColPolygonPoint
- setColPolygonHeight
- setColPolygonPointPosition
- setColShapeRadius
- setColShapeSize