This update was mostly just organizing the code, it's now split into seperate classes and files along with additional configurations so I can hopefully get this to work with dgdk and maybe create a special dbc version(since dbc is always left out
).
I still haven't got heightfields worked out yet so I'll probably save that for v0.6 and get plane and capsule geoms in first. ODE CREATE STATIC SPHERE was added and so was ODE CREATE STATIC TRIANGLEMESH with the optional geom param.
I did add in a few other miscellaneous commands:
ODE SET WORLD CONTACT SURFACE LAYER value
ODE SET AUTO DISABLE FLAG value
ODE SET AUTO DISABLE LINEAR THRESHOLD value
ODE SET AUTO DISABLE ANGULAR THRESHOLD value
ODE SET AUTO DISABLE STEPS value
ODE SET AUTO DISABLE TIME value
When you download you should also noticed it is renamed as dbpODE.dll so make sure you delete the older Release/Debug Ode dll from your user-plugins folder
Edit:
And I also finished up the breakable joints demo, not perfect but it gets the idea across.
` Ode Joint Feedback Test
` Author: Christian Ang
` Sync
Sync On
Sync Rate 60
Autocam Off
` Start Ode
Ode Start
` Create a Jointed Object [ Bridge ]
Ode Create Joint Group 1
For i=1 to 6
Make Object Box i,10,2,50
Position Object i,-70+i*20,-20,0
Ode Create Dynamic Box i
Ode Set Body Mass i,700.0
Ode Create Hinge Joint i,1
Ode Set Hinge Anchor i,-80+i*20,-20,0
Ode Set Hinge Axis i,0,1,0
Ode Attach Joint i,i,i-1
Ode Set Hinge Param i,4,8000
Ode Set Joint Feedback i
Next i
Ode Create Hinge Joint 7,1
Ode Set Hinge Anchor 7,60,-20,0
Ode Set Hinge Axis 7,0,1,0
Ode Attach Joint 7,6,0
Ode Set Joint Feedback 7
` Floor
Make Object Box 8,100,20,100
Position Object 8,0,-50,0
Ode Create Static Box 8
Position Camera 0,20,-200
j=1
Make Object Sphere 9,5,5,5
Color Object 9,255
` Create Array to save joint stress time
Dim stress(7) as integer
Dim forcelimit(7) as integer
null = Make Vector3(1)
null = Make Vector3(2)
for i=0 to 3
forcelimit(i) = 80000-i*10000
forcelimit(7-i) = 80000-i*10000
next i
` Main Loop
Do
` Show Joint Feedback
if leftkey()=1 and r=0 and j>1 then dec j:r=1
if rightkey()=1 and r=0 and j<7 then inc j:r=1
if scancode()=0 then r=0
Text 0,0,"Switch Joint with left/right keys - Drop boxes with Space - Break selected joint with Enter"
Text 0,20,"--Joint Information--"
Text 0,40,"ID: "+str$(j)
Text 0,60,"Body 1: "+str$(Ode Get Joint Body(j,0))
Text 0,80,"Body 2: "+str$(Ode Get Joint Body(j,1))
Text 0,100,"A1X: "+str$(Ode Get Hinge Anchor X(j,1))
Text 0,120,"A1Y: "+str$(Ode Get Hinge Anchor Y(j,1))
Text 0,140,"A1Z: "+str$(Ode Get Hinge Anchor Z(j,1))
Text 0,160,"A2X: "+str$(Ode Get Hinge Anchor X(j,2))
Text 0,180,"A2Y: "+str$(Ode Get Hinge Anchor Y(j,2))
Text 0,200,"A2Z: "+str$(Ode Get Hinge Anchor Z(j,2))
Text 0,220,"AxisX:"+str$(Ode Get Hinge Axis X(j))
Text 0,240,"AxisY:"+str$(Ode Get Hinge Axis Y(j))
Text 0,260,"AxisZ:"+str$(Ode Get Hinge Axis Z(j))
Set Vector3 1,Ode Get Joint Feedback Force X(j,1),Ode Get Joint Feedback Force Y(j,1),Ode Get Joint Feedback Force Z(j,1)
Set Vector3 2,Ode Get Joint Feedback Force X(j,2),Ode Get Joint Feedback Force Y(j,2),Ode Get Joint Feedback Force Z(j,2)
Text 250,300,"B2FV: "+str$(Length Vector3(1))
Text 250,320,"B2FV: "+str$(Length Vector3(2))
Text 250,20,"--Joint Feedback Info--"
Text 250,40,"B1FX: "+str$(Ode Get Joint Feedback Force X(j,1))
Text 250,60,"B1FY: "+str$(Ode Get Joint Feedback Force Y(j,1))
Text 250,80,"B1FZ: "+str$(Ode Get Joint Feedback Force Z(j,1))
Text 250,100,"B2FX: "+str$(Ode Get Joint Feedback Force X(j,2))
Text 250,120,"B2FY: "+str$(Ode Get Joint Feedback Force Y(j,2))
Text 250,140,"B2FZ: "+str$(Ode Get Joint Feedback Force Z(j,2))
Text 250,160,"B1TX: "+str$(Ode Get Joint Feedback Torque X(j,1))
Text 250,180,"B1TY: "+str$(Ode Get Joint Feedback Torque Y(j,1))
Text 250,200,"B1TZ: "+str$(Ode Get Joint Feedback Torque Z(j,1))
Text 250,220,"B2TX: "+str$(Ode Get Joint Feedback Torque X(j,2))
Text 250,240,"B2TY: "+str$(Ode Get Joint Feedback Torque Y(j,2))
Text 250,260,"B2TZ: "+str$(Ode Get Joint Feedback Torque Z(j,2))
` If object force is too much and for too long then break joint
For k=1 to 7
Set Vector3 1,Ode Get Joint Feedback Force X(k,1),Ode Get Joint Feedback Force Y(k,1),Ode Get Joint Feedback Force Z(k,1)
Set Vector3 2,Ode Get Joint Feedback Force X(k,2),Ode Get Joint Feedback Force Y(k,2),Ode Get Joint Feedback Force Z(k,2)
b = Ode Get Joint Body(k,0)
if b > 0 then Color Object b, rgb(50 + 6 * Length Vector3(1)/6000, 0, 0)
If Length Vector3(1) > forcelimit(k) or Length Vector3(2) > forcelimit(k)
stress(k)=stress(k)+1
Else
stress(k)=0
Endif
if stress(k)=60
a = Ode Get Joint Body(k,0)
b = Ode Get Joint Body(k,1)
` Because it is disabled after detach; reactive
if a > 0 then Ode Enable Body a
if b > 0 then Ode Enable Body b
Ode Attach Joint k,0,0
Endif
Next k
` Allow them to snap bridge at joints
If returnkey()=1 and r=0
a = Ode Get Joint Body(j,0)
b = Ode Get Joint Body(j,1)
Ode Attach Joint j,0,0
` Because it is disabled after detach; reactive
if a > 0 then Ode Set Linear Velocity a,0,0,0
if b > 0 then Ode Set Linear Velocity b,0,0,0
r=1
Endif
` Create a Box to drop onto the bridge
If spacekey()=1 and r=0
i=FindFreeObj()
Make Object Cube i,25
Position Object i,0,100,0
Ode Create Dynamic Box i
Ode Set Body Mass i,500.0
r=1
Endif
Position Object 9, Ode Get Hinge Anchor X(j,1), Ode Get Hinge Anchor Y(j,1), Ode Get Hinge Anchor Z(j,1)
` Update Physics
Ode Update
` Sync
Sync
Loop
Function FindFreeObj()
repeat
inc i
until Object Exist(i)=0
EndFunction i