Run this:
phy start
phy set gravity 0, -10, 0
set camera range 0.01, 1000
`----------------------------------------
make object box 100, 4, 0.3, 4
position object 100, 0, -0.5, 0
phy make rigid body static box 100
color object 100, rgb( 0, 255, 0 )
`----------------------------------------
`----------------------------------------
`Chest
MakeObjectCapsule( 1, 0.045 * 6, 0.025 * 6 )
position object 1, 0, ( 0.3 - 0.06 ) * 6, 0 + 10
rotate object 1, 0, 0, 90
phy make rigid body dynamic capsule 1
MakeObjectCapsule( 2, 0.045 * 6, 0.030 * 6 )
position object 2, 0, ( 0.3 - 0.0725 ) * 6, 0 + 10
rotate object 2, 0, 0, 90
phy make rigid body dynamic capsule 2
MakeObjectCapsule( 3, 0.040 * 6, 0.025 * 6 )
position object 3, 0, ( 0.3 - 0.085 ) * 6, 0 + 10
rotate object 3, 0, 0, 90
phy make rigid body dynamic capsule 3
MakeObjectCapsule( 4, 0.035 * 6, 0.0225 * 6 )
position object 4, 0, ( 0.3 - 0.1 ) * 6, 0 + 10
rotate object 4, 0, 0, 90
phy make rigid body dynamic capsule 4
MakeObjectCapsule( 5, 0.030 * 6, 0.020 * 6 )
position object 5, 0, ( 0.3 - 0.11 ) * 6, 0 + 10
rotate object 5, 0, 0, 90
phy make rigid body dynamic capsule 5
MakeObjectCapsule( 6, 0.030 * 6, 0.025 * 6 )
position object 6, 0, ( 0.3 - 0.13 ) * 6, 0.0075 + 10
rotate object 6, 0, 0, 90
phy make rigid body dynamic capsule 6
`----------------------------------------
`Head
MakeObjectCapsule( 7, 0.0125 * 6, 0.0325 * 6 )
position object 7, 0, ( 0.3 - 0.0245 ) * 6, 0 + 10
phy make rigid body dynamic capsule 7
`----------------------------------------
`Thighs
MakeObjectCapsule( 8, 0.055 * 6, 0.0225 * 6 )
position object 8, 0.08, ( 0.3 - 0.1725 ) * 6, 0
phy make rigid body dynamic capsule 8
MakeObjectCapsule( 9, 0.055 * 6, 0.0225 * 6 )
position object 9, -0.08, ( 0.3 - 0.1725 ) * 6, 0
phy make rigid body dynamic capsule 9
`Shins
MakeObjectCapsule( 10, 0.055 * 6, 0.020 * 6 )
position object 10, 0.08, ( 0.3 - 0.235 ) * 6, 0 + 10
phy make rigid body dynamic capsule 10
MakeObjectCapsule( 11, 0.055 * 6, 0.020 * 6 )
position object 11, -0.08, ( 0.3 - 0.235 ) * 6, 0 + 10
phy make rigid body dynamic capsule 11
`Feet
make object box 12, 0.0225 * 6, 0.0125 * 6, 0.0375 * 6
position object 12, 0.08, ( 0.3 - 0.275 ) * 6, -0.04 + 10
phy make rigid body dynamic box 12
make object box 13, 0.0225 * 6, 0.0125 * 6, 0.0375 * 6
position object 13, -0.08, ( 0.3 - 0.275 ) * 6, -0.04 + 10
phy make rigid body dynamic box 13
`----------------------------------------
`Biceps
MakeObjectCapsule( 14, 0.050 * 6, 0.015 * 6 )
position object 14, 0.25, ( 0.3 - 0.08 ) * 6, 0
phy make rigid body dynamic capsule 14
MakeObjectCapsule( 15, 0.050 * 6, 0.015 * 6 )
position object 15, -0.25, ( 0.3 - 0.08 ) * 6, 0
phy make rigid body dynamic capsule 15
`Cubids
MakeObjectCapsule( 16, 0.040 * 6, 0.0135 * 6 )
position object 16, 0.25, ( 0.3 - 0.13 ) * 6, 0
phy make rigid body dynamic capsule 16
MakeObjectCapsule( 17, 0.040 * 6, 0.0135 * 6 )
position object 17, -0.25, ( 0.3 - 0.13 ) * 6, 0
phy make rigid body dynamic capsule 17
`Hands
make object box 18, 0.008 * 6, 0.03 * 6, 0.02 * 6
position object 18, 0.25, ( 0.3 - 0.165 ) * 6, 0
phy make rigid body dynamic box 18
make object box 19, 0.008 * 6, 0.03 * 6, 0.02 * 6
position object 19, -0.25, ( 0.3 - 0.165 ) * 6, 0
phy make rigid body dynamic box 19
`----------------------------------------
phy set rigid body group 1, 1
phy set rigid body group 2, 1
phy set rigid body group 3, 1
phy set rigid body group 4, 1
phy set rigid body group 5, 1
phy set rigid body group 6, 1
phy set rigid body group 7, 1
phy set rigid body group 8, 3
phy set rigid body group 9, 4
phy set rigid body group 10, 1
phy set rigid body group 11, 2
phy set rigid body group 12, 1
phy set rigid body group 13, 2
phy set rigid body group 14, 7
phy set rigid body group 15, 7
phy set rigid body group 16, 5
phy set rigid body group 17, 6
phy set rigid body group 18, 5
phy set rigid body group 19, 6
phy set group collision 1, 1, 0
phy set group collision 1, 3, 0
phy set group collision 1, 4, 0
phy set group collision 1, 7, 0
phy set group collision 2, 2, 0
phy set group collision 2, 4, 0
phy set group collision 5, 5, 0
phy set group collision 5, 7, 0
phy set group collision 6, 6, 0
phy set group collision 6, 7, 0
phy set group collision 1, 5, 0
phy set group collision 1, 6, 0
`----------------------------------------
Height# = -.25
Angle# = 180
sync on
sync rate 60
do
phy update
if leftkey() then Angle# = wrapvalue( Angle# - 1.5 )
if rightkey() then Angle# = wrapvalue( Angle# + 1.5 )
if upkey() then Height# = Height# + 0.01
if downkey() then Height# = Height# - 0.01
position camera 2 * sin( Angle# ), Height#, 2 * cos( Angle# )
point camera 0, Height#, 0
sync
loop
function MakeObjectCapsule( ObjectNumber, Height#, Diameter# )
`A function to make a capsule object
Height# = Height# / 2
`Height# = Height# - Diameter# `Calculate length of straight section
if Height# < 0 then exitfunction `Exit if diameter is greater than height
Rows = 11 `Set detail level
Columns = 16
make object sphere ObjectNumber, Diameter#, Rows, Columns `Make object to be deformed
lock vertexdata for limb ObjectNumber, 0, 1
for Vertex = 0 to get VertexData Vertex Count()
`Get the vertex's current position
xPosition# = get VertexData Position X( Vertex )
yPosition# = get VertexData Position Y( Vertex )
zPosition# = get VertexData Position Z( Vertex )
`Find out if vertex is in top or bottom of sphere, and move up or down accordingly
if yPosition# > 0
set VertexData Position Vertex, xPosition#, yPosition# + Height#, zPosition#
else
set VertexData Position Vertex, xPosition#, yPosition# - Height#, zPosition#
endif
next Vertex
unlock vertexdata
`Make the finished object
make mesh from object 5000, ObjectNumber `Save the capsule shaped mesh
delete object ObjectNumber `Delete the temporary object
make object ObjectNumber, 5000, 0 `Make a new object from the mesh
delete mesh 5000 `Delete the mesh
endfunction
Does anyone know why the capsules don't touch the floor properly?
It looks like the physics object is longer than the visual one...