Code archives/3D Graphics - Mesh/CreatePillMesh()

This code has been declared by its author to be Public Domain code.

Download source code

CreatePillMesh() by bytecode772006
This function creates a capsule mesh. It is like the CreateJointMesh() function included to my physic engine.
It is nothing special but a help for beginners :)
Function CreatePillMesh(rad# = 1, height# = 2, seg = 8)
mesh = CreateCylinder(seg * 2)
ScaleMesh mesh, rad#, height# * .5, rad#
c = CreateSphere(seg)
ScaleMesh c, rad#, rad#, rad#
PositionMesh c, 0, height# * .5, 0
AddMesh c, mesh
FreeEntity c
c = CreateSphere(seg)
ScaleMesh c, rad#, rad#, rad#
PositionMesh c, 0, -height# * .5, 0
AddMesh c, mesh
FreeEntity c
Return mesh
End Function

Comments

None.

Code Archives Forum