well this is a simple one and explanation can be found
here if you need some.
EDIT: use spacekey to blow wind, mouse to move around.
Rem ***** Main Source File *****
REM DEFAULTS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SYNC ON
AUTOCAM OFF
SET DISPLAY MODE 640, 480, 16
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM VARIABLES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
scrFps = 90
gmGravity = -9.8
nwtFluidDens = 0.9
nwtFluidLinV = 0.5
nwtFluidAngV = 0.5
wrldSizeX = 5000.0
wrldSizeY = 5000.0
wrldSizeZ = 5000.0
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM INIT NEWTON
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GOSUB lblr_newtonInit
REM SET NEWTON GRAVITY AND BUOYANCY
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NDB_SetVector 0.0, gmGravity, 0.0
NDB_SetStandardGravity
NDB_GetStandardGravity
NDB_SetStandardLiquid nwtFluidDens, nwtFluidLinV, nwtFluidAngV
NDB_NewtonSetMinimumFrameRate scrFps * 2
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM SET NEWTON WORLD
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NDB_SetVector 1, -wrldSizeX, -wrldSizeY, -wrldSizeZ
NDB_SetVector 2, wrldSizeX, wrldSizeY, wrldSizeZ
NDB_NewtonSetWorldSize
NDB_NewtonSetBodyLeaveWorldEvent 1
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM CREATE WORLD HERE
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`Ground Image
Create Bitmap 1, 10, 10
Set Current Bitmap 1
Line 0, 5, 10, 5
Line 5, 0, 5, 10
iGround = freeImage()
Get Image iGround, 0, 0, 10, 10
Set Current Bitmap 0
Delete Bitmap 1
`Ball Image
Create Bitmap 1, 10, 10
Set Current Bitmap 1
Ink Rgb (255, 0, 0), 0
Line 0, 5, 10, 5
Ink Rgb (255, 255, 255), 0
iBall = freeImage()
Get Image iBall, 0, 0, 10, 10
Set Current Bitmap 0
Delete Bitmap 1
oGround = freeObject()
Make Object Box oGround, 1000, 10, 1000
Position Object oGround, 0, -10, 0
Texture Object oGround, iGround
Scale Object Texture oGround, 50, 50
nGround = nwtCollisionBox(oGround, 0.0, 0, 0, nwtMatDefault)
`----------------------------------------------------------------
REM CURTAIN PART STARTS HERE
`----------------------------------------------------------------
Dim Curtain(6) As Integer
oCurtBase = freeObject()
Make Object Box oCurtBase, 50, 2, 2
Position Object oCurtBase, 0, 50, 0
Texture Object oCurtBase, iBall
Curtain(0) = nwtCollisionBox(oCurtBase, 0.0, 0, 0, nwtMatDefault)
oS = freeObject()
For obj = oS To oS+5
Make Object Plain obj, 48, 8
Position Object obj, 0, 50-(8*Obj)+20, 0
inc nObj
Curtain(nObj) = nwtCollisionBox(obj, 1.0, 1, 0, nwtMatBall)
NDB_NewtonBodySetAutoFreeze Curtain(nObj), 0
Next obj
nwtBallJoint(Curtain(1), Curtain(0), "DOWN", 30, 30, 0)
nwtBallJoint(Curtain(2), Curtain(1), "DOWN", 30, 30, 0)
nwtBallJoint(Curtain(3), Curtain(2), "DOWN", 30, 30, 0)
nwtBallJoint(Curtain(4), Curtain(3), "DOWN", 30, 30, 0)
nwtBallJoint(Curtain(5), Curtain(4), "DOWN", 30, 30, 0)
nwtBallJoint(Curtain(6), Curtain(5), "DOWN", 30, 30, 0)
`----------------------------------------------------------------
REM CURTAIN PART ENDS HERE
`----------------------------------------------------------------
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM MAIN LOOP
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Position Camera 0, 10, -50
mx = mouseX() : mmx = mouseMoveX()
my = mouseY() : mmy = mouseMoveY()
GOSUB lblr_newtonTimerSet
DO
GOSUB lblr_newtonTimerLoop
`GOSUB lblr_newtonVehicleDrive
mx = mouseX() : mmx = mouseMoveX()
my = mouseY() : mmy = mouseMoveY()
ax# = wrapvalue(ax# + mmy)
ay# = wrapvalue(ay# + mmx)
rotate camera ax#, ay#, 0.0
if mouseclick()=1 then move camera 1
if mouseclick()=2 then move camera -1
`----------------------------------------------------------------
REM ADD FORCES TO CURTAIN HERE
`----------------------------------------------------------------
if Spacekey()
NDB_SetVector 0.0, 0.0, 1.0
NDB_NewtonBodySetVelocity Curtain(6)
`Unrem below to see variations
`NDB_SetVector 1.0, 0.0, -1.0
`NDB_NewtonBodySetVelocity Curtain(3)
endif
Set Cursor 0, 0
Print "Press F12 to turn Debug Info On/Off"
GOSUB lblr_newtonDebug
LOOP
GOSUB lblr_newtonDestroy
END
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lblr_newtonInit:
REM GLOBAL VARIABLES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
REM NEWTON
`GLOBAL nwtFps As Integer
GLOBAL nwtTime As Float
GLOBAL nwtFluidDens As Float
GLOBAL nwtFluidLinV As Float
GLOBAL nwtFluidAngV As Float
GLOBAL nwtBody As Integer
GLOBAL nwtJoint As Integer
REM NEWTON MATERIALS
GLOBAL nwtMatDefault As Integer
GLOBAL nwtMatBall As Integer
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM CREATE
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NDB_NewtonCreate
NDB_NewtonSetSolverModel n
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM SET NEWTON MATERIALS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
nwtMatDefault = NDB_NewtonMaterialGetDefaultGroupID()
nwtMatBall = NDB_NewtonMaterialCreateGroupID()
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM SET NEWTON MATERIALS COLLISIONS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`what happens when nMatBall has collision with nMatDefault
NDB_NewtonMaterialSetDefaultCollidable nwtMatBall, nwtMatDefault, 1
NDB_NewtonMaterialSetDefaultFriction nwtMatBall, nwtMatDefault, 0.7, 0.5
NDB_NewtonMaterialSetDefaultElasticity nwtMatBall, nwtMatDefault, 1.0
NDB_NewtonMaterialSetCollisionCallback nwtMatBall, nwtMatDefault
REM VEHICLE
REMSTART
`what happens when nwtMatCarHull has collision with nwtMatCarTire
NDB_NewtonMaterialSetDefaultCollidable nwtMatCar, nwtMatDefault, 1
NDB_NewtonMaterialSetDefaultFriction nwtMatCar, nwtMatDefault, 0.7, 0.5
NDB_NewtonMaterialSetDefaultElasticity nwtMatCar, nwtMatDefault, 0.2
NDB_NewtonMaterialSetDefaultSoftness nwtMatCar, nwtMatDefault, 0.2
NDB_NewtonMaterialSetCollisionCallback nwtMatCar, nwtMatDefault
REMEND
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
RETURN
lblr_newtonTimerSet:
REM GET TIMERS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
nwtTime = NDB_GetElapsedTimeInSec()
nwtTime = NDB_GetElapsedTimeInSec()
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
RETURN
lblr_newtonTimerLoop:
REM START LOOP
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
nwtTime = NDB_GetElapsedTimeInSec()
NDB_NewtonUpdate nwtTime*1000
REMSTART
For vehicle = 1 to 10
If nwtCar(vehicle,0).jN <> 0
NDB_NewtonUpdateTires nwtCar(vehicle,0).jN
EndIf
Next vehicle
REMEND
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
RETURN
lblr_newtonDebug:
REM DEBUG NEWTON - F12 KEY
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
If KeyState(88) = 1 And N_DEBUG_ON = 0 Then N_DEBUG_ON = 1
If N_DEBUG_ON = 1
N_DEBUG_ON = 2
Inc N_Debug, 1
If N_Debug > 1 Then N_Debug = 0
EndIf
If KeyState(88) = 0 Then N_DEBUG_ON = 0
If N_Debug = 1
obj = NDB_DebugMakeNewtonObject()
Set Object Light obj, 0
Else
obj = 0
EndIf
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM SYNC SCREEN
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sync
If obj <> 0
Delete Object obj
EndIf
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
RETURN
lblr_newtonDestroy:
REM DESTROY NEWTON AND END THE PROGRAM
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NDB_NewtonDestroy
END
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
RETURN
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Mass = object mass
`Gravity = effected by gravity or not
`Buoyancy = effected by buoyancy or not
`nMaterial = newton Material
Function nwtCollisionBox(obj As Integer, Mass As Float, Gravity As Boolean, Buoyancy As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateBox(sx#, sy#, sz#) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_CalculateMIBoxSolid Mass, sx#, sy#, sz#
NDB_NewtonBodySetMassMatrix nwtBody, Mass
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_BodySetGravity nwtBody, Gravity
if Not Buoyancy = 0
NDB_BodySetBuoyancy nwtBody, Buoyancy
NDB_SetVector 1, 0.0, gmWaterLevel, 0.0, 0.0 `buoyancy plain is at y=10, you can change this value to your need.
NDB_BodySetBuoyancyPlane nwtBody
endif
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Mass = object mass
`Gravity = effected by gravity or not
`Buoyancy = effected by buoyancy or not
`nMaterial = newton Material
Function nwtCollisionSphere(obj As Integer, Mass As Float, Gravity As Boolean, Buoyancy As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj) / 2.0
sy# = object size y(obj) / 2.0
sz# = object size z(obj) / 2.0
rd# = object size (obj) / 2.0
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateSphere(sx#, sy#, sz#) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nwtBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_CalculateMISphereSolid Mass, rd#
NDB_NewtonBodySetMassMatrix nwtBody, Mass
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_BodySetGravity nwtBody, Gravity
if Not Buoyancy = 0
NDB_BodySetBuoyancy nwtBody, Buoyancy
NDB_SetVector 1, 0.0, gmWaterLevel, 0.0, 0.0 `buoyancy plain is at y=10, you can change this value to your need.
NDB_BodySetBuoyancyPlane nwtBody
endif
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Mass = object mass
`Gravity = effected by gravity or not
`Buoyancy = effected by buoyancy or not
`nMaterial = newton Material
Function nwtCollisionCylinder(obj As Integer, Mass As Float, Gravity As Boolean, Buoyancy As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
rd# = object size (obj) / 2.0
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateCylinder(rd#, sy#) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_CalculateMICylinderSolid Mass, rd#, sy#
NDB_NewtonBodySetMassMatrix nwtBody, Mass
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_BodySetGravity nwtBody, Gravity
if Not Buoyancy = 0
NDB_BodySetBuoyancy nwtBody, Buoyancy
NDB_SetVector 1, 0.0, gmWaterLevel, 0.0, 0.0 `buoyancy plain is at y=10, you can change this value to your need.
NDB_BodySetBuoyancyPlane nwtBody
endif
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Mass = object mass
`Gravity = effected by gravity or not
`Buoyancy = effected by buoyancy or not
`nMaterial = newton Material
Function nwtCollisionCapsule(obj As Integer, Mass As Float, Gravity As Boolean, Buoyancy As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
rd# = object size (obj) / 2.0
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateCylinder(rd#, sy#) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_CalculateMICylinderSolid Mass, rd#, sy#
NDB_NewtonBodySetMassMatrix nwtBody, Mass
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_BodySetGravity nwtBody, Gravity
if Not Buoyancy = 0
NDB_BodySetBuoyancy nwtBody, Buoyancy
NDB_SetVector 1, 0.0, gmWaterLevel, 0.0, 0.0 `buoyancy plain is at y=10, you can change this value to your need.
NDB_BodySetBuoyancyPlane nwtBody
endif
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Mass = object mass
`Gravity = effected by gravity or not
`Buoyancy = effected by buoyancy or not
`nMaterial = newton Material
Function nwtCollisionCone(obj As Integer, Mass As Float, Gravity As Boolean, Buoyancy As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
rd# = object size (obj) / 2.0
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateCylinder(rd#, sy#) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_CalculateMICylinderSolid Mass, rd#, sy#
NDB_NewtonBodySetMassMatrix nwtBody, Mass
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_BodySetGravity nwtBody, Gravity
if Not Buoyancy = 0
NDB_BodySetBuoyancy nwtBody, Buoyancy
NDB_SetVector 1, 0.0, gmWaterLevel, 0.0, 0.0 `buoyancy plain is at y=10, you can change this value to your need.
NDB_BodySetBuoyancyPlane nwtBody
endif
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Mass = object mass
`Gravity = effected by gravity or not
`Buoyancy = effected by buoyancy or not
`nMaterial = newton Material
Function nwtCollisionConvex(obj As Integer, Mass As Float, Gravity As Boolean, Buoyancy As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
rd# = object size (obj) / 2.0
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateConvexHull(obj) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_CalculateMIBoxSolid Mass, sx#, sy#, sz#
NDB_NewtonBodySetMassMatrix nwtBody, Mass
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_BodySetGravity nwtBody, Gravity
if Not Buoyancy = 0
NDB_BodySetBuoyancy nwtBody, Buoyancy
NDB_SetVector 1, 0.0, gmWaterLevel, 0.0, 0.0 `buoyancy plain is at y=10, you can change this value to your need.
NDB_BodySetBuoyancyPlane nwtBody
endif
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`obj = object number
`Limbs = perform tree collision with or without limbs
`nMaterial = newton Material
Function nwtCollisionTree(obj As Integer, Limbs As Boolean, nMaterial As Integer)
x# = object position x(obj)
y# = object position y(obj)
z# = object position z(obj)
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
rd# = object size (obj) / 2.0
rx# = object angle x(obj)
ry# = object angle y(obj)
rz# = object angle z(obj)
Col = NDB_NewtonCreateTreeCollision(obj, Limbs) `Col newton primitive
nwtBody = NDB_NewtonCreateBody(Col) `nBody is the collision data
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix nwtBody
NDB_NewtonReleaseCollision Col `we dont need newton primitive anymore
NDB_BodySetDBProData nwtBody, obj `we link the newton obj to visual obj
NDB_NewtonBodySetDestructorCallback nwtBody `if newton obj leaves the world borders, it destroys itself and the linked visual object as well
NDB_NewtonBodySetMaterialGroupID nwtBody, nMaterial
EndFunction nwtBody
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`nBody1 = child newton object
`nBody2 = parent newton object
`direction = direction of joint
`coneLmt = cone limit
`twistLmt = twist limit
`collision = child/parent are collidible or not
Function nwtBallJoint(nBody1 As Integer, nBody2 As Integer, direction As String, coneLmt As Float, twistLmt As Float, collision As Boolean)
x# = Object Position X( NDB_GetDBPro(nBody2) )
y# = Object Position Y( NDB_GetDBPro(nBody2) )
z# = Object Position Z( NDB_GetDBPro(nBody2) )
sx# = Object Size X( NDB_GetDBPro(nBody2) ) / 2.0
sy# = Object Size Y( NDB_GetDBPro(nBody2) ) / 2.0
sz# = Object Size Z( NDB_GetDBPro(nBody2) ) / 2.0
ax# = Object Angle X( NDB_GetDBPro(nBody2) )
ay# = Object Angle Y( NDB_GetDBPro(nBody2) )
az# = Object Angle Z( NDB_GetDBPro(nBody2) )
if direction = "UP"
NDB_SetVector 1, x#, y#+sy#, z#
NDB_SetVector 2, 0.0, 1.0, 0.0
endif
if direction = "DOWN"
NDB_SetVector 1, x#, y#-sy#, z#
NDB_SetVector 2, 0.0, -1.0, 0.0
endif
if direction = "LEFT"
NDB_SetVector 1, x#-sx#, y#, z#
NDB_SetVector 2, -1.0, 0.0, 0.0
endif
if direction = "RIGHT"
NDB_SetVector 1, x#+sx#, y#, z#
NDB_SetVector 2, 1.0, 0.0, 0.0
endif
if direction = "FRONT"
NDB_SetVector 1, x#, y#, z#+sz#
NDB_SetVector 2, 0.0, 0.0, 1.0
endif
if direction = "BACK"
NDB_SetVector 1, x#, y#, z#-sz#
NDB_SetVector 2, 0.0, 0.0, -1.0
endif
if direction = "CENTER"
NDB_SetVector 1, x#, y#, z#
NDB_SetVector 2, 0.0, 0.0, 0.0
endif
nwtJoint = NDB_NewtonConstraintCreateBall( nBody1, nBody2 )
if coneLmt <> 0.0 or twistLmt <> 0.0
NDB_NewtonBallSetConeLimits nwtJoint, coneLmt, twistLmt
endif
NDB_NewtonJointSetCollisionState nwtJoint, collision
NDB_BuildMatrix ax#, ay#, az#, x#, y#, z#
NDB_NewtonBodySetMatrixRecursive nBody2
EndFunction nwtJoint
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`nBody1 = child newton object
`nBody2 = parent newton object
`direction = direction of joint
`limitMin = min limit
`limitMAx = max limit
`collision = child/parent are collidible or not
Function nwtHingeJoint(nBody1 As Integer, nBody2 As Integer, direction As String, limitMin As Float, limitMax As Float, collision As Boolean)
x# = Object Position X( NDB_GetDBPro(nBody2) )
y# = Object Position Y( NDB_GetDBPro(nBody2) )
z# = Object Position Z( NDB_GetDBPro(nBody2) )
sx# = Object Size X( NDB_GetDBPro(nBody2) ) / 2.0
sy# = Object Size Y( NDB_GetDBPro(nBody2) ) / 2.0
sz# = Object Size Z( NDB_GetDBPro(nBody2) ) / 2.0
ax# = Object Angle X( NDB_GetDBPro(nBody2) )
ay# = Object Angle Y( NDB_GetDBPro(nBody2) )
az# = Object Angle Z( NDB_GetDBPro(nBody2) )
if direction = "UP"
NDB_SetVector 1, x#, y#+sy#, z#
NDB_SetVector 2, 0.0, 1.0, 0.0
endif
if direction = "DOWN"
NDB_SetVector 1, x#, y#-sy#, z#
NDB_SetVector 2, 0.0, -1.0, 0.0
endif
if direction = "LEFT"
NDB_SetVector 1, x#-sx#, y#, z#
NDB_SetVector 2, -1.0, 0.0, 0.0
endif
if direction = "RIGHT"
NDB_SetVector 1, x#+sx#, y#, z#
NDB_SetVector 2, 1.0, 0.0, 0.0
endif
if direction = "FRONT"
NDB_SetVector 1, x#, y#, z#+sz#
NDB_SetVector 2, 0.0, 0.0, 1.0
endif
if direction = "BACK"
NDB_SetVector 1, x#, y#, z#-sz#
NDB_SetVector 2, 0.0, 0.0, -1.0
endif
if direction = "CENTER"
NDB_SetVector 1, x#, y#, z#
NDB_SetVector 2, 0.0, 0.0, 0.0
endif
nwtJoint = NDB_NewtonConstraintCreateHinge( nBody1, nBody2 )
if limitMin <> 0.0 or limitMax <> 0.0
NDB_SetHingeLimits nwtJoint, limitMin, limitMax
endif
NDB_NewtonJointSetCollisionState nwtJoint, collision
NDB_BuildMatrix ax#, ay#, az#, x#, y#, z#
NDB_NewtonBodySetMatrixRecursive nBody2
EndFunction nwtJoint
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`nBody1 = child newton object
`nBody2 = parent newton object
`direction = direction of joint
`limitMin = min limit
`limitMAx = max limit
`collision = child/parent are collidible or not
Function nwtSliderJoint(nBody1 As Integer, nBody2 As Integer, direction As String, limitMin As Float, limitMax As Float, collision As Boolean)
x# = Object Position X( NDB_GetDBPro(nBody2) )
y# = Object Position Y( NDB_GetDBPro(nBody2) )
z# = Object Position Z( NDB_GetDBPro(nBody2) )
sx# = Object Size X( NDB_GetDBPro(nBody2) ) / 2.0
sy# = Object Size Y( NDB_GetDBPro(nBody2) ) / 2.0
sz# = Object Size Z( NDB_GetDBPro(nBody2) ) / 2.0
ax# = Object Angle X( NDB_GetDBPro(nBody2) )
ay# = Object Angle Y( NDB_GetDBPro(nBody2) )
az# = Object Angle Z( NDB_GetDBPro(nBody2) )
if direction = "UP"
NDB_SetVector 1, x#, y#+sy#, z#
NDB_SetVector 2, 0.0, 1.0, 0.0
endif
if direction = "DOWN"
NDB_SetVector 1, x#, y#-sy#, z#
NDB_SetVector 2, 0.0, -1.0, 0.0
endif
if direction = "LEFT"
NDB_SetVector 1, x#-sx#, y#, z#
NDB_SetVector 2, -1.0, 0.0, 0.0
endif
if direction = "RIGHT"
NDB_SetVector 1, x#+sx#, y#, z#
NDB_SetVector 2, 1.0, 0.0, 0.0
endif
if direction = "FRONT"
NDB_SetVector 1, x#, y#, z#+sz#
NDB_SetVector 2, 0.0, 0.0, 1.0
endif
if direction = "BACK"
NDB_SetVector 1, x#, y#, z#-sz#
NDB_SetVector 2, 0.0, 0.0, -1.0
endif
if direction = "CENTER"
NDB_SetVector 1, x#, y#, z#
NDB_SetVector 2, 0.0, 0.0, 0.0
endif
nwtJoint = NDB_NewtonConstraintCreateSlider( nBody1, nBody2 )
if limitMin <> 0.0 or limitMax <> 0.0
NDB_SetSliderLimits nwtJoint, limitMin, limitMax
endif
NDB_NewtonJointSetCollisionState nwtJoint, collision
NDB_BuildMatrix ax#, ay#, az#, x#, y#, z#
NDB_NewtonBodySetMatrixRecursive nBody2
EndFunction nwtJoint
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`nBody1 = child newton object
`nBody2 = parent newton object
`direction = direction of joint
`limitMin = min limit
`limitMAx = max limit
`collision = child/parent are collidible or not
Function nwtCorkscrewJoint(nBody1 As Integer, nBody2 As Integer, direction As String, angleMin As Float, angleMax As Float, distMin As Float, distMax As Float, collision As Boolean)
x# = Object Position X( NDB_GetDBPro(nBody2) )
y# = Object Position Y( NDB_GetDBPro(nBody2) )
z# = Object Position Z( NDB_GetDBPro(nBody2) )
sx# = Object Size X( NDB_GetDBPro(nBody2) ) / 2.0
sy# = Object Size Y( NDB_GetDBPro(nBody2) ) / 2.0
sz# = Object Size Z( NDB_GetDBPro(nBody2) ) / 2.0
ax# = Object Angle X( NDB_GetDBPro(nBody2) )
ay# = Object Angle Y( NDB_GetDBPro(nBody2) )
az# = Object Angle Z( NDB_GetDBPro(nBody2) )
if direction = "UP"
NDB_SetVector 1, x#, y#+sy#, z#
NDB_SetVector 2, 0.0, 1.0, 0.0
endif
if direction = "DOWN"
NDB_SetVector 1, x#, y#-sy#, z#
NDB_SetVector 2, 0.0, -1.0, 0.0
endif
if direction = "LEFT"
NDB_SetVector 1, x#-sx#, y#, z#
NDB_SetVector 2, -1.0, 0.0, 0.0
endif
if direction = "RIGHT"
NDB_SetVector 1, x#+sx#, y#, z#
NDB_SetVector 2, 1.0, 0.0, 0.0
endif
if direction = "FRONT"
NDB_SetVector 1, x#, y#, z#+sz#
NDB_SetVector 2, 0.0, 0.0, 1.0
endif
if direction = "BACK"
NDB_SetVector 1, x#, y#, z#-sz#
NDB_SetVector 2, 0.0, 0.0, -1.0
endif
if direction = "CENTER"
NDB_SetVector 1, x#, y#, z#
NDB_SetVector 2, 0.0, 0.0, 0.0
endif
nwtJoint = NDB_NewtonConstraintCreateCorkscrew( nBody1, nBody2 )
if angleMin <> 0.0 or angleMax <> 0.0 or distMin <> 0.0 or distMax <> 0.0
NDB_SetCorkscrewLimits nwtJoint, angleMin, angleMax, distMin, distMax
endif
NDB_NewtonJointSetCollisionState nwtJoint, collision
NDB_BuildMatrix ax#, ay#, az#, x#, y#, z#
NDB_NewtonBodySetMatrixRecursive nBody2
EndFunction nwtJoint
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`nBody1 = child newton object
`nBody2 = parent newton object
`direction = direction of joint
`limitMin = min limit
`limitMAx = max limit
`collision = child/parent are collidible or not
Function nwtUniversalJoint(nBody1 As Integer, nBody2 As Integer)
x# = Object Position X( NDB_GetDBPro(nBody2) )
y# = Object Position Y( NDB_GetDBPro(nBody2) )
z# = Object Position Z( NDB_GetDBPro(nBody2) )
sx# = Object Size X( NDB_GetDBPro(nBody2) ) / 2.0
sy# = Object Size Y( NDB_GetDBPro(nBody2) ) / 2.0
sz# = Object Size Z( NDB_GetDBPro(nBody2) ) / 2.0
ax# = Object Angle X( NDB_GetDBPro(nBody2) )
ay# = Object Angle Y( NDB_GetDBPro(nBody2) )
az# = Object Angle Z( NDB_GetDBPro(nBody2) )
NDB_SetVector 1, x#, y#-sy#, z#
NDB_SetVector 2, 0.0, -1.0, 0.0
NDB_SetVector 3, 0.0, 1.0, 0.0
nwtJoint = NDB_NewtonConstraintCreateUniversal( nBody1, nBody2 )
NDB_BuildMatrix 0.0, 0.0, 0.0, x#, y#, z#
NDB_NewtonBodySetMatrixRecursive nBody2
EndFunction nwtJoint
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`nBody1 = child newton object
`nBody2 = parent newton object
`direction = direction of joint
`limitMin = min limit
`limitMAx = max limit
`collision = child/parent are collidible or not
Function nwtUpvectorJoint(nBody1 As Integer)
NDB_SetVector 1, 0.0, 1.0, 0.0
nwtJoint = NDB_NewtonConstraintCreateUpVector( nBody1 )
EndFunction nwtJoint
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
REM THIS FUNCTION IS NEVER CALLED
Function nwtNeverCalled()
if memblock exist(1) then end
if mesh exist (1) then end
EndFunction
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_functionsFree:
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeDll()
Repeat
Inc i
Until DLL Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMemblock()
Repeat
Inc i
Until MemBlock Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeObject()
Repeat
Inc i
Until Object Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeSound()
Repeat
Inc i
Until Sound Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMusic()
Repeat
Inc i
Until Music Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeAnimation()
Repeat
Inc i
Until Animation Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeBitmap()
Repeat
Inc i
Until Bitmap Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeEffect()
Repeat
Inc i
Until Effect Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeImage()
Repeat
Inc i
Until Image Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeLight()
Repeat
Inc i
Until Light Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeLimb()
Repeat
Inc i
Until Limb Exist(i,i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMatrix()
Repeat
Inc i
Until Matrix Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMesh()
Repeat
Inc i
Until Mesh Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freePixelshader()
Repeat
Inc i
Until Pixel Shader Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeParticles()
Repeat
Inc i
Until Particles Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeSprite()
Repeat
Inc i
Until Sprite Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeTerrain()
Repeat
Inc i
Until Terrain Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeVertexshader()
Repeat
Inc i
Until Vertex Shader Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeFile()
Repeat
Inc i
Until File Open(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<