Super-compact ODE demo and a question

Blitz3D Forums/Blitz3D Userlibs/Super-compact ODE demo and a question

JoshK(Posted 2004) [#1]
I hate looking at other programmer's demos. I hate sifting through bloated code that adds fancy little extras I could code myself in five seconds, just so I can find the two or three lines of stuff I actually need. A demo should be as compact as possible, and only demonstrate the aspect of programming it is designed to teach.

I like this demo because it gets rid of those ridiculous floaty dreamlike physics. Here ya go:
Const dParamLoStop 			= 0
Const dParamHiStop			= 1
Const dParamVel				= 2
Const dParamVel2			= 258
Const dParamFMax			= 3
Const dParamFMax2			= 259
Const dParamFudgeFactor		= 4
Const dParamBounce			= 5
Const dParamCFM				= 6
Const dParamStopERP			= 7
Const dParamStopCFM			= 8
Const dParamSuspensionERP	= 9
Const dParamSuspensionCFM	= 10

Const dContactMu2			= $001
Const dContactFDir1			= $002
Const dContactBounce		= $004
Const dContactSoftERP		= $008
Const dContactSoftCFM		= $010
Const dContactMotion1		= $020
Const dContactMotion2		= $040
Const dContactSlip1			= $080
Const dContactSlip2			= $100
Const dContactApprox0		= $0000
Const dContactApprox1_1		= $1000
Const dContactApprox1_2		= $2000
Const dContactApprox1		= $3000

Graphics3D 800,600,16,2

cam=CreateCamera()
RotateEntity cam,35,0,0
MoveEntity cam,0,0,-50

CreateLight()

plane=CreatePlane()
EntityFX plane,1
tex=CreateTexture(32,32)
SetBuffer TextureBuffer(tex)
Color 200,200,200
Rect 0,0,32,32
Color 200,0,0
Rect 0,0,16,16
Rect 16,16,16,16
ScaleTexture tex,6,6
EntityTexture plane,tex

world=ODE_dWorldCreate(1)
ODE_dSetContactMode(dContactSoftERP+dContactSoftCFM)
ODE_dSetSOFT_ERP 0.4
ODE_dWorldSetGravity 0,-1,0

body=ODE_dBodyCreate()
geom=ODE_dCreateBox(world,10,10,10,1)
ODE_dGeomSetBody geom,body
ODE_dBodySetPosition body,0,20,0
ODE_dBodySetRotation body,45,45,45
ODE_dBodySetMass body,10
mesh=CreateCube()
EntityColor mesh,0,0,255
ScaleMesh mesh,5,5,5
EntityPickMode mesh,2,1

While Not KeyHit(1)
	ODE_dWorldQuickStep 0.02
	PositionEntity mesh,ODE_dGeomGetPositionX(geom),ODE_dGeomGetPositionY(geom),ODE_dGeomGetPositionZ(geom)
	RotateEntity mesh,ODE_dGeomGetPitch(geom),ODE_dGeomGetYaw(geom),ODE_dGeomGetRoll(geom)
	RenderWorld
	Flip False
	Wend
ODE_dCloseODE()
End


As for the question, I figured it out.


GfK(Posted 2004) [#2]
A demo should be as compact as possible, and only demonstrate the aspect of programming it is designed to teach.
No that's "tutorials". Demos, would you believe, are designed to demonstrate what others have achieved. Hence, "demo".
I hate looking at other programmer's demos
Then don't do it? <edit> Bouncer got there first. Oh well.


JoshK(Posted 2004) [#3]
Ummm, moderator?


Pongo(Posted 2004) [#4]
yea,... I don't know what's up today, but those comments are totally uncalled for.


Bouncer(Posted 2004) [#5]
No they're not. Halo is always calling comments like that with his idiotic behaviour.


JaviCervera(Posted 2004) [#6]
Did he in this occasion?


JoshK(Posted 2004) [#7]
There's always such an emotional reaction any time I post source. People don't seem to get upset if it's some GUI technical thing, but if I post anything 3D, it seems like it makes people cry.


JoshK(Posted 2004) [#8]
Here's another example, with delta timing. I'll just keep posting these as I develop it.



chris_b(Posted 2004) [#9]
What .dll and .decls are you using for these examples?

Is there a fully working ODE wrapper available now or are you using the one that freezes the physics simulation periodically?


JoshK(Posted 2004) [#10]
I use the one that freezes up!


Damien Sturdy(Posted 2005) [#11]
nice one :)


but if I post anything 3D, it seems like it makes people cry.




Your '3D' breath must stink of garlick (sp?)