New ODE 0.5 wrapper for Blitz3D

Blitz3D Forums/Blitz3D Programming/New ODE 0.5 wrapper for Blitz3D

Proger(Posted 2004) [#1]
First beta version BlitzODE 0.5 wrapper.
http://blitz.pp.ru/file/BlitzODE_0_5_b.rar

80% from ALL ODE functions.


AntonyWells(Posted 2004) [#2]
Nice. Is ode easy to use compared to say tokamak? If you know.


Proger(Posted 2004) [#3]
ODE simple and comfortable to use. In new 0.5 version addition TriMesh collisions. In future I will add it to wrapper.


.rIKmAN.(Posted 2004) [#4]
Is there any documentation at all?

I have seen the list of commands in the .decls file but have no idea what they do etc...

Thanks!


Perturbatio(Posted 2004) [#5]
http://ode.org/


Tom(Posted 2004) [#6]
Great work arkon!!!!

Thanks
Tom


CopperCircle(Posted 2004) [#7]
Wow, this is great.


Gabriel(Posted 2004) [#8]
Sweet. A very generous contribution.


PsychicParrot(Posted 2004) [#9]
I've been hoping someone would build a new ODE wrapper for a while now .. excellent work! I am a big fan of ODE, but I don't have the knowledge to do something like this. Thankyou so much for sharing it with us!


.rIKmAN.(Posted 2004) [#10]
Ah I didn`t realise that I could use the ODE docs, I thought the wrapper would have its own B3D docs, like Tokamak does.

Do they commands translate directly then?


Proger(Posted 2004) [#11]
Coming soon...


Proger(Posted 2004) [#12]
Added new tutorial.
http://blitz.pp.ru/file/SimpleCarTest.rar


AdrianT(Posted 2004) [#13]
hey very nice, might be just in time for our game :), the simple car physics is a bit spongy but shows potential. Seems better than the tocomak stuff I saw before.


TheMan(Posted 2004) [#14]
Looks very good, but can I use if I want to sell my game?


Mustang(Posted 2004) [#15]
Wheee - have to take a look at this stuff... thanks!


Proger(Posted 2004) [#16]
I added TriMesh collision.

http://blitz.pp.ru/file/BlitzODE_0_52_b.rar

Enjoy!


Spacemonkey(Posted 2004) [#17]
I like it !!!


Rob(Posted 2004) [#18]
Hi, brilliant work!

Regarding the car, why are you using spheres for wheels?


Proger(Posted 2004) [#19]
because in original ODE samples wheels are done using spheres...:)


Vorderman(Posted 2004) [#20]
This is great, but ODE has always suffered from problems with carsims trying to keep the rear wheels in line - if you read the ODE mailing lists this problem has never really been solved, and it means you always get rear wheel steering at higher speeds.

When I used my original ODE wrapper I had this problem, and I could never find a way around it, which in the end rendered the system useless for car sims, at least those involving higher speeds (someone else here used it really well for a slower Halo-style buggy - Island Storm was it??).

I really hope someone can solve the problem as the carwheel joint is great and gives instant and very customisable suspension, and can give much better results than Tokamak.


Rob(Posted 2004) [#21]
This is easily portable to mac and linux (the source is all there) so at a guess I would say ODE is the future of Blitz physics.

You can even sell your stuff with ODE. So it's probably worth ironing out problems this early and getting a good community following. Tokamak and ODE both rock, and are the only proper engines we can use.


Beaker(Posted 2004) [#22]
If you want an ODE section adding to the playerfactory forums just e-mail me.
http://playerfactory.proboards25.com/


Damien Sturdy(Posted 2004) [#23]
woohoo! ive been working with ode in a project for ages and weve had to be careful by using careful level designs.. Is this release stable? :D


Proger(Posted 2004) [#24]
stable :)))


Mustang(Posted 2004) [#25]
So.. I guess I have to use the "TriMesh collision" if I want to drive around using my own mesh?

[edit] Ah, damn, it's already in the new updated car demo - cool! :)


Damien Sturdy(Posted 2004) [#26]
umm, you could do that before in the old wrapper, what is trimesh collision? :S


Damien Sturdy(Posted 2004) [#27]
"ODE has always suffered from problems with carsims trying to keep the rear wheels in line - if you read the ODE mailing lists this problem has never really been solved, and it means you always get rear wheel steering at higher speeds."


I just played with it and i dont realy get it now.. i dont know what i did to fix that though :S


Rob(Posted 2004) [#28]
I am moving my project over from tokamak to ODE.

Please keep up the excellent work Arkon :)


Caff(Posted 2004) [#29]
nice, thanks for this arkon!


Damien Sturdy(Posted 2004) [#30]
ive had something good goin for a coupla monthsnow.. but nowODE is stable, i have a problem- i gota be fast before you loada skilled guys beat me to it ^.^


AntonyWells(Posted 2004) [#31]
Checked out the demos and it looks sweet...

I'mt thinking of integrating this into Vivid.I take it as this is a wrapper to an public domain lib, this is public domain too?


Mustang(Posted 2004) [#32]

I take it as this is a wrapper to an public domain lib, this is public domain too?



http://ode.org/ode-license.html


Proger(Posted 2004) [#33]
...


Picklesworth(Posted 2004) [#34]
Hm. Very nice physics. And while I was driving the car demo around I thought of a great idea which I will speak of no more for now. Judging by the samples that come with it though, I'm not at all impressed by the car, and I hope that it was a problem with it's mass or something. It feels way too heavy, and definietly wouldn't go over well with game use. The rest seems very nice and stable though, and since it's open source I can always expect it to grow (just so long as the lib does too).
Nice job arkon!


Eric(Posted 2004) [#35]
Arkon,

I have a program, Fairly long now, that is Tokamak Based. IT seems like all the supported commands In ODE That I need are here. Thanks, It seems as though Tokamak is Dead, so I think I will take the time to Transform to ODE.

One Question: The TriMesh Commands. Can you give me a small sample of there use?

Regards,
Eric

Is ODE Better than Tokamak? Just for Info.


slenkar(Posted 2004) [#36]
can it do ragdoll effects?


Damien Sturdy(Posted 2004) [#37]
yes, it can do ragdoll effects, with a small amount of effort...

it is joint based too.

and it is 10x better at car sims than toka ^.^

Mr picklesworth, we both have some good ideas, i hope yours isnt the same as mine ^.^


Proger(Posted 2004) [#38]
Sample TriMesh - ODE_Tutorial_3_1.bb


Eric(Posted 2004) [#39]
And Where is that Tutorial?

Edit..Found them


Picklesworth(Posted 2004) [#40]
Hehe, shouldn't be eric. Mine was completely random. See my worklog to find it.

I'm very glad that my game is set in the future so I can get away with having absolutely no regular car sims. It can all just be sensors and apply impulses :)

Are there convex hulls in ODE?


Proger(Posted 2004) [#41]
Yes, but the triangle mesh class is not final, so in the future API changes might be expected.


Eric(Posted 2004) [#42]
How about Collision Detection?


Proger(Posted 2004) [#43]
working on it


Eric(Posted 2004) [#44]
Arkon,

Have you played with Tokamak? I really would like to know if ODE is better.

As soon as you are able to get collision detection in there, I will transform my game to ODE. And Do a comparison.

Thanks for Wrapping this.

Regards,
Eric


Beaker(Posted 2004) [#45]
Blitz ODE forum here:
http://playerfactory.proboards25.com


CopperCircle(Posted 2004) [#46]
Arkon, the wrapper is progressing well, but I think there is a bug with ODE Cylinders and TriMesh's, the cylinders act crazy when they collide with the TriMesh.


Damien Sturdy(Posted 2004) [#47]
i cant get trimesh working >.< hellp


Rob(Posted 2004) [#48]
Arkon, there is an invisible "floor" to the world which I would like you to remove if possible. I assume you create it for debugging purposes?

MODERATORS: how about sticky? this is rapidly becoming incredibly powerful. ODE is more powerful and capable than tokamak, and is also cross platform.


Damien Sturdy(Posted 2004) [#49]
@bloodlocust: From what i remember, ODE has an invisible floor at Y=0

Ive always got around it by loading everything 1000 or so units above it (depending on level size) :)


Rob(Posted 2004) [#50]
Thanks Cyg :)

Also, It appears I too am having trouble getting my own b3d meshes working. I am using LoadMesh and nothing fancy... strange. There should be no hierarchy with loadmesh.


Damien Sturdy(Posted 2004) [#51]
This new version seems to add the mesh to a bank and sends it to ODE
you must scalemesh it down rather than use normal mesh commands
thats kinda limiting to be honest.

How about doing it how the old one did? storing the blitz collision stuff and sending THAT to ode instead?


Damien Sturdy(Posted 2004) [#52]
Okay, the trimesh totally f**ks up when the mesh is textured. what on earth? hehe... cant be too dificult to fix.. il take a look :S


jhocking(Posted 2004) [#53]
Can you post the package as a zip?


Damien Sturdy(Posted 2004) [#54]
rightey, The problem lies that when it loads the textures the meshes can get split up, and its not functioning properly with multi surface, il post it fixed if he arkon doesnt!


Filax(Posted 2004) [#55]
Great work !!!! thanks !


Bot Builder(Posted 2004) [#56]
*bot_builder migrates

If only tokamak had better friction :( ohwell, the problems with ODE crashing etc are fixed now?


Damien Sturdy(Posted 2004) [#57]
@bot builder; if anyone who used it before recompiled it with a larger stack as the website says to, itd work before :P

IM in the middle of repairing his trimesh collision, but my way round it is in his trimesh create routine:

1) regenerate the mesh without textures, as a single surface
2) add the info for THAT mesh to the trimesh collision
3) delete the created mesh from memory


Damien Sturdy(Posted 2004) [#58]
actually, its a simple maths problem with it (with multi surfaces its sending all the triangles connected with vertices of the first surface)....


Rob(Posted 2004) [#59]
Righto, so it has to be a single surface mesh. Easily fixed.

What would be nice is finding the point of collision and how hard they collided. Posssible? And also of course having different physical properties per triangle.

For example, grass and tarmac...


Damien Sturdy(Posted 2004) [#60]
I just fixed it ^.^
Replace the old ODE_dTriMeshCreate% function with this (blitzode.bb)

Function ODE_dTriMeshCreate%(mesh%)
	tris_count% = 0
	vert_count% = 0
	For i = 1 To CountSurfaces(mesh)
		tris_count = tris_count + CountTriangles(GetSurface(mesh, i))
		vert_count = vert_count + CountVertices(GetSurface(mesh, i))
	Next
	DebugLog "Tris count: " + tris_count
	DebugLog "Vertices count: " + vert_count
		DebugLog "surface count: "+CountSurfaces(mesh)
	vertices_bank% = CreateBank(vert_count * 4 * 4)
	indices_bank% = CreateBank(tris_count * 3 * 4)

	offset% = 0
	offset_tris% = 0
	baseverts=0
	For i = 1 To CountSurfaces(mesh)
		sf = GetSurface(mesh, i)
		For v = 0 To CountVertices(sf) - 1
			PokeFloat vertices_bank, offset, VertexX(sf, v)
			offset = offset + 4
			PokeFloat vertices_bank, offset, VertexY(sf, v)
			offset = offset + 4
			PokeFloat vertices_bank, offset, VertexZ(sf, v)
			offset = offset + 8
		Next
		For t = 0 To CountTriangles(sf) - 1
			For j = 0 To 2
				v = TriangleVertex(sf, t, j)+baseverts
				PokeInt indices_bank, offset_tris, v
				offset_tris = offset_tris + 4
			Next
		Next
		baseverts=baseverts+CountVertices(sf)
	Next
	
	t_data = ODE_dGeomTriMeshDataCreate()
	ODE_dGeomTriMeshDataBuildSimple(t_data, vertices_bank, vert_count, indices_bank, tris_count * 3)
 
	Return ODE_dCreateTriMesh(space, t_data)
End Function



Bot Builder(Posted 2004) [#61]
Simple enough fix:

<snip>doh cross post</snip>

Is it possible to call this multiple times? In tokamak I had to do some stuff to get a bunch of meshs into one mesh bank.

Const VertexCount = 5
Const IndexCount = 12

Global size#[3]
Dim Vertices#(5, 3)
Global Indices%[12]
Global vr%[5]


This is no longer required on the top of the 03_01 tutorial.


Damien Sturdy(Posted 2004) [#62]
great minds, eh bot builder?

I beleive youd just use a mesh joiner from the code archives then send that mesh across


Rob(Posted 2004) [#63]
sweet! fix works perfectly.

Hey - do cylinders work okay? Someone seems to be having problems with those.


Damien Sturdy(Posted 2004) [#64]
Can anyone here recompile it with double the stack space? I cant even run this with ten cars :(


Filax(Posted 2004) [#65]
Hi :) i'm testing ODE i have made a little include for setup easily
box and sphere :)




CopperCircle(Posted 2004) [#66]
I have been playing with the car demo, it's not great but more stable. Have a look...

I have also added some useful functions to the BlitzODE.bb

http://www.apaj15.dsl.pipex.com/BlitzODE_Test.zip (342k)


Eric(Posted 2004) [#67]
I'm Looking around for some sort of Linear and Angular Dampining Commands like in Tokamak, has anyone come across them?


Damien Sturdy(Posted 2004) [#68]
you can do it by Getting the values, doing a *.99 or something, then setting them. i think thats what you want!


Damien Sturdy(Posted 2004) [#69]
By the way, im also adding commands that make this ODE version compatible with code people has done before, so itl take alot less to convert over :)


Rob(Posted 2004) [#70]
I'm Looking around for some sort of Linear and Angular Dampining Commands like in Tokamak, has anyone come across them?

These are easy and are in the actual sourcecode examples.

in the 03_01 car sample, there is
ax# = ODE_dBodyGetAngularVelX(cbody[0]) * .7
ay# = ODE_dBodyGetAngularVelY(cbody[0]) * .8
az# = ODE_dBodyGetAngularVelZ(cbody[0]) * .7
ODE_dBodySetAngularVel(cbody[0], ax#, ay#, az#)


Make something like... (untested):

Function ODE_AngularDamp(geombody,dampx#,dampy#,dampz#)
ax# = ODE_dBodyGetAngularVelX(geombody) * dampx
ay# = ODE_dBodyGetAngularVelY(geombody) * dampy
az# = ODE_dBodyGetAngularVelZ(geombody) * dampz
ODE_dBodySetAngularVel(geombody,ax#,ay#,az#)
End Function

Call each frame instead of once like tokamak and ti will angular damp. Linear damp will damp your momentum so look for the relevant commands to do that... At least I think this is the procedure to use.


Rob(Posted 2004) [#71]
Oh yes one more thing: I think the *dumb* floor at Y=0 should be optional and the cylinder physics are *broken* :)

So thats an official bug. I've got loads of helper functions but I wanna wait and see what goes on with convex hulls. It would be sweet if it supports QHULL, like tokamak and coldet.


Eric(Posted 2004) [#72]
Blood,

Worked Like a Champ, I just thought that maybe there was a built in command.. thanks for the Code and Reply.

Regards,
Eric


Filax(Posted 2004) [#73]
Is there a way to scan object scale for automate the ODE box
around object ??? i have try



But seem don't work well ?? i don't know why


CopperCircle(Posted 2004) [#74]
Filax, look at my ODE_CreateBox function in the test I posted above, that scales the mesh to the ODE box size, just make sure your mesh is centerd on it's axis.


Rob(Posted 2004) [#75]
Here's mine. Elegent (I thought):
;links entities to rigid bodies
Function ODELink(ent,geo)
	o.odelink=New odelink
	o\ent=ent
	o\geo=geo
End Function

;updates entity transforms to match rigid bodies
Function ODEUpdateLinks()
	For o.odelink=Each odelink
		PositionEntity o\ent, ODE_dGeomGetPositionX(o\geo), ODE_dGeomGetPositionY(o\geo), ODE_dGeomGetPositionZ(o\geo)
		RotateEntity o\ent, ODE_dGeomGetPitch(o\geo), ODE_dGeomGetYaw(o\geo), ODE_dGeomGetRoll(o\geo),1
	Next
End Function

;creates a rigid body cube from a source entity's dimensions and link them together
Function ODECube(ent)
	;get transform
	x#=EntityX(ent,1)
	y#=EntityY(ent,1)
	z#=EntityZ(ent,1)
	sx#=MeshWidth(ent)
	sy#=MeshHeight(ent)
	sz#=MeshDepth(ent)

	;create ode rigid body
	o.odebody = New odebody
	o\body = ODE_dBodyCreate()

	;create the rigid body geometry for ode
	o\geo = ODE_dCreateBox(ODE,sx,sy,sz,10)
	ODE_dGeomSetBody o\geo, o\body

	;set position and rotation
	ODE_dBodySetPosition(o\body,x,y,z)
	ODE_dBodySetRotation(o\body,0,0,0)

	;link
	ODELink(ent,o\geo)
	
	Return o\body
End Function


An Example of use:
For i=1 To 100
	temp=CreateCube()
	PositionEntity temp,Rand(-100,100),100,Rand(-100,100)

	;turn it into an ode object
	obj = ODECube(temp)
Next


my mainloop:
;mainloop
While Not KeyHit(1)
	UpdateInput()
	
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed
	ticks=elapsed/period
	tween#=Float(elapsed Mod period)/Float(period)
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

		UpdateGame()
		
		ODEUpdate(0.1) ;required before updateworld
		UpdateWorld
	Next

	ODEUpdateLinks() ;required before renderworld
	RenderWorld tween
	
	Flip
Wend
ODEEnd()
End



I think my set of code sets out an easy working practise that is well organised and suitable for importing objects. The concept is simple, you provide the meshes and then you convert them into ode objects. You'll find in most cases, this is what you want to do anyway...


Proger(Posted 2004) [#76]
I finished adding collision handle...

Only userlib with new update: http://blitz.pp.ru/file/userlibs.rar

Added new functions:
ODE_dBodyGetCollisionsCount%(body%)
ODE_dBodyGetCollisionDepth#(body%, num%)
ODE_dBodyGetCollisionBody%(body%, num%)
ODE_dBodyGetCollisionGeom%(body%, num%)
ODE_dBodyGetCollisionX#(body%, num%)
ODE_dBodyGetCollisionY#(body%, num%)
ODE_dBodyGetCollisionZ#(body%, num%)
ODE_dBodyGetCollisionNX#(body%, num%)
ODE_dBodyGetCollisionNY#(body%, num%)
ODE_dBodyGetCollisionNZ#(body%, num%)
ODE_dBodyGetCollisionFX#(body%, num%)
ODE_dBodyGetCollisionFY#(body%, num%)
ODE_dBodyGetCollisionFZ#(body%, num%)

Enjoy!


RepeatUntil(Posted 2004) [#77]
Thank you very much for this wrapper!
My game uses Tokamak, and I encounter a lot of bugs with it. But, I won't switch so easily to ODE: is there *really* less bug that in Tokamak? Is it really better?


Mustang(Posted 2004) [#78]

The concept is simple, you provide the meshes and then you convert them into ode objects. You'll find in most cases, this is what you want to do anyway...



Yup! And although multi-surface meshes (for ODE) were already fixed, I think that it might be good to do separate single surface meshes for physics, like for terrains... you can use higher resolution mesh for rendering and lower resolution for physics.

How do I use the collisions that were just added? For example how can I know if the car has collided to something and then get the info what was the exact object it collided with?

And how would I do 1st person cameras with this... there would be no need to use any built-in Blitz collisions at all if I can do my player collisions with this too.

And what about humanish ragdolls - any examples / tutorials anyone?


Proger(Posted 2004) [#79]
Demo for collision response - http://blitz.pp.ru/file/ODE_Tutorial_04_00.zip


Sweenie(Posted 2004) [#80]
I'm actually thinking about moving my carsimulation over to ODE aswell.
I'm starting to get fed up with all the workarounds I have to do with Tokamak all the time.

But I'm gonna use the same method for handling wheels.
That is, using cylinders to handle the collisions but using my own code to handle the friction of the wheels.


Wayne(Posted 2004) [#81]
I must check this out.


Filax(Posted 2004) [#82]
Thanks for help :) i'll try it :)

Very good wrapper ! thanks


Damien Sturdy(Posted 2004) [#83]
fun fun fun

I now have 25 cars racing around a track with me ^.^

Dudes, someone here must be able to recompile this DLL for me? i need to push it past its current limits... im stuck with using the quick update function at the moment :(


Cheers


Rob(Posted 2004) [#84]
Arkon, nice work! There is a BUG with cylinders though.

How do I use the collisions that were just added? For example how can I know if the car has collided to something and then get the info what was the exact object it collided with?

And how would I do 1st person cameras with this... there would be no need to use any built-in Blitz collisions at all if I can do my player collisions with this too.

Mustang, just like blitz Collisions!
count = ODE_dBodyGetCollisionsCount(box) ;CountCollisions(ent)

;loop through all collisions...
For i = 0 To count-1
	depth# = ODE_dBodyGetCollisionDepth(box, i) ;force of collision... (depth)... use FX for a true force.
	collidedwith = ODE_dBodyGetCollisionBody(box,i) ;the body it collided with...
Next

And so on! the rest are detailed in the decls file.

ODE_dBodyGetCollisionsCount%(body%)
ODE_dBodyGetCollisionDepth#(body%, num%)
ODE_dBodyGetCollisionBody%(body%, num%)
ODE_dBodyGetCollisionGeom%(body%, num%)
ODE_dBodyGetCollisionX#(body%, num%)
ODE_dBodyGetCollisionY#(body%, num%)
ODE_dBodyGetCollisionZ#(body%, num%)
ODE_dBodyGetCollisionNX#(body%, num%)
ODE_dBodyGetCollisionNY#(body%, num%)
ODE_dBodyGetCollisionNZ#(body%, num%)
ODE_dBodyGetCollisionFX#(body%, num%)
ODE_dBodyGetCollisionFY#(body%, num%)
ODE_dBodyGetCollisionFZ#(body%, num%)



Using the loop through methodology with 'num', it's easy to get all the data we need, when we need it! This is SO much more easier to use and more powerful than Tokamak.

Full credit to sweenie and vorderman for getting our projects off the ground. But now I think it's pretty certain that ODE is king.

Regarding my code above... if you pass a child of an imported mesh to it, for example the car body, it will find the dimensions and fit an ODE cube around it (non uniform of course!) then glue them together. You won't see the cube of course - you will only see the mesh... but it's useful for all sorts. I have easily extended the cube to sphere, cylinder (with axis param) and so on... it makes parsing your b3d file for named objects and converting them into ode objects a complete breeze. I think I'm in love.

Arkon... cylinder bug? :)


Rob(Posted 2004) [#85]
Cylinders jitter with madness when colliding with a mesh.


CopperCircle(Posted 2004) [#86]
Arkon, collisions update is great, but I have also mentioned the cylinder bug, I know you must be busy but it would be useful to use cylinders :)


Damien Sturdy(Posted 2004) [#87]
VERY useful. but, since we have the "source code", why not have a crack yourself? (me and bloodlocust fixed the multi surface mesh problem- though i posted fix first :P)


Filax(Posted 2004) [#88]
A new version of my include :)




Proger(Posted 2004) [#89]
Cylinder bug...
I working on it


Rob(Posted 2004) [#90]
Thank you :)

Filax... please use [codebox] tag... my poor little mousewheel cannot take your passionate text.


Filax(Posted 2004) [#91]
ok :)


Rob(Posted 2004) [#92]
Arkon:
ODE_dSpaceQuery is missing from the lib.


Rob(Posted 2004) [#93]
Bug: either objects are not exactly same size as blitz units or the mesh scale is somehow wrong.

If you examine closely, there is a space between ODE objects and trimesh. The Space does not exist with object to object.


Rob(Posted 2004) [#94]
Don't forget to read the docs from ODE site everyone.


Eric(Posted 2004) [#95]
I need to know if The Invisible Floor and Y=0 is something perminate. Because I want my origin to be 0,0,0. I don't want to have to use offsets.

Regards,
Eric


Rob(Posted 2004) [#96]
Yes the invisible floor is a huge problem, for example, space sims...


Damien Sturdy(Posted 2004) [#97]
my invisible floor just broke... and so did all my collisions :S argh!!!!!!!


Rob(Posted 2004) [#98]
Check your rigid body has a "space" parameter filled in when you create it. Space of 0 will make it a body that doesn't belong to any space.

Spaces are ODE's concept of collision groups.


Damien Sturdy(Posted 2004) [#99]
well, i just copied some proved working functions across from one of my working demos... it doesnt work now :S

however, the fact that some of the stuff is working: and i dont have a plane at y=0... could be a good thing!


Rob(Posted 2004) [#100]
REGARDING CAR PROBLEMS:

if you read the ODE mailing lists this problem has never really been solved, and it means you always get rear wheel steering at higher speeds.
IF you read the faq of the latest docs, it shows that there are two new commands that fix this problem of rear wheel steering. Apparently the problem occurs as a result of floating point inaccuracy at high speeds during rotation. The two commands ensure any problems are taken care of.


Eric(Posted 2004) [#101]
I guess what I need to know is if the Y=0 Floor is a function of ODE or one that is in there for Blitz.

Regards,
Eric


Rob(Posted 2004) [#102]
ODE.


Damien Sturdy(Posted 2004) [#103]
it is ODE.

i sorted my prob out and i am now seeing what bloodlocust saw: a gap underneith the objects :S


Tom(Posted 2004) [#104]
Anyone up to doing some ODE vs Tokamak benchmark tests?

Despite what a few people have said, Tokamak is very stable IMO, It's never crashed or crapped out on me!

Having said that, ODE looks to be the ideal engine for vehicles.

It's just really nice that we now have 2 choices!

Tom


fredborg(Posted 2004) [#105]
Hi,

This is really great! I would like it very much if you could add the Geometry Transform Class to the library (described in chapter 10.7.7 in the ODE manual), as this would make construction of Composite objects (chapter 10.9) much more useful.

Keep up the great work!


CopperCircle(Posted 2004) [#106]
Arkon, thanks I hope you solve the cylinder bug.

Cygnus, we don't have the source for the dll so I can't look at the problem, the problem you fixed was to do with the Blitz code.

I also notice the gap between bodys and a trimesh, I put some shadows on the car wheels and you can see it floating.


Filax(Posted 2004) [#107]
It is possible to scan all child in a loadanimmesh for automatic
add box around object ? i ha ve try this code but seem don't work well



But my object become "crazy" !!! i think that my code for calculate
mesh child scale is bugged, but i don't find where.

Anybody have an example code for test child mesh scale ?


Rob(Posted 2004) [#108]
See my code above filax. It does this.


Rob(Posted 2004) [#109]
I post again :)
;creates a rigid body cube from a source entity's dimensions and link them together
Function ODECube(ent)
	;get transform
	x#=EntityX(ent,1)
	y#=EntityY(ent,1)
	z#=EntityZ(ent,1)
	sx#=MeshWidth(ent)
	sy#=MeshHeight(ent)
	sz#=MeshDepth(ent)

	;create ode rigid body
	o.odebody = New odebody
	o\body = ODE_dBodyCreate()

	;create the rigid body geometry for ode
	o\geo = ODE_dCreateBox(ODE,sx,sy,sz,10)
	ODE_dGeomSetBody o\geo, o\body

	;set position and rotation
	ODE_dBodySetPosition(o\body,x,y,z)
	ODE_dBodySetRotation(o\body,0,0,0)

	;link
	ODELink(ent,o\geo)
	
	Return o\body
End Function



Filax(Posted 2004) [#110]
Hi ;) thanks for reply, i have test your code but the

sx#=MeshWidth(ent)
sy#=MeshHeight(ent)
sz#=MeshDepth(ent)

don't fit exactly the child mesh ? the 3DS scale seem to be different
than blitz scale.

If you have and exemple of search and applying box under an
animmesh :) please :)


Rob(Posted 2004) [#111]
I understand. To fix this, you need to apply resetXform in 3dsmax.

This is because in 3dsmax, you can move the vertices (meshwidth/height/depth is changed) but you can also scale it (multiplies the meshwidth etc results). Scaling in max will scale the imported Entity. Which will change the results of MeshWidth, MeshHeight and MeshDepth.

ResetXform makes EntityScale (not meshscale) =1

To find the EntityScale, look in code archives for functions by sswift.

But easiest method? ResetXForm in max :)


Filax(Posted 2004) [#112]
I have try it but no result :( i'm disapointed ... i'm sure that there is
a possibility to setup physic under 3D software like 3DS MAX.


Rob(Posted 2004) [#113]
I am doing this already. Export your models as B3D using pipeline and examine your code.


Damien Sturdy(Posted 2004) [#114]
Coppercircle... you can get the source to the DLL ;) i realy doubt arkon would be able to fix DLL issues, unless he is knowledgable in C++ and then he may be.
But looking at this ODE wrapper, yes, he has done an excelent job, but anyone who knows how to read the ode manual and do decls could, with time, have done this.. i was considering it...

He has done a bloody great job though, hasnt he :D


Rob(Posted 2004) [#115]
don't you think you should just shut up someimes cygnus? :)


Filax(Posted 2004) [#116]
BloodLocust : I have some result but it's not perfect

http://www.blitz3dfr.com/tempo/TestODE.zip

My object seem to be good (axis, xform etc) but the physic
make them trembled ??

But you have reason on a point, i must do Xform reset, under max


Damien Sturdy(Posted 2004) [#117]
I was bored ;) and my computer wasnt working, and this was the only window open :/ Sorry if that seemed a bit like i was picking, but i was pretty anoyed at this computer and its inability to stay functional for more than 30 seconds... Luckily, with the new wrapper, it wasnt ODE breaking it this time ^.^


Rob(Posted 2004) [#118]
SILENCE! or feel my rigid body :P


Paolo(Posted 2004) [#119]
Wow,
Many thanks Arkon, this is sweet ! :)

As a first look, it seems pretty stable to me, and faster to set up than tokamak.

But one, question,
is it any way to set independent friction or "air resistance" for each element?, it is just that when you move an element it remains moving for a lot more time than it should be. If I remember well, you could set this in tokamak with the "linear dumping" and "angular dumping" stuff,... maybe there's something similar here?

Thanks!
Paolo.


Damien Sturdy(Posted 2004) [#120]
at least, im helping bump the topic a little higher :P


Anyone come across any vehicle problems?

When i steer, my body nearly flips over and i cant seem to get the back wheels to slide

Ive tried to just write wrapper commands to the old ode, (which has worked and now my old engine is running).. but the wheels are now super sticky and i realy dont know what to do ^.^


Eric(Posted 2004) [#121]
For some reason, I am have the opposite, I am having a hard time setting up ODE.

Can someone help me visualize, Seperate Geoms to make up one object. Are the X,Y,Z and Roll, Yaw, Pitch the same as Blitz. I want to create Alpha .5 cubes where the Geoms are located to help me assemble a complex RB.


Skitchy(Posted 2004) [#122]
Can somebody put together some sort of type based MakeVehicle() function for us to mess around with?
Its a lazy mans request, but then, I'm a lazy man ;)


Tom(Posted 2004) [#123]
arkon, does ODEs coordinate system match Blitzs?

I seem to recall the original ODE DLL stuck with ODEs system, which I think was X+ = BBs Z+, that made it confusing to setup thing in Blitz

Cheers
Tom


Proger(Posted 2004) [#124]
I have considered this while making the wrapper...:)


Proger(Posted 2004) [#125]
I fixed bugs...
Colliding Cylinder + TriMesh

added parameter for ODE_dWorldCreate function
ODE_dWorldCreate(1) - with floor plane
ODE_dWorldCreate(0) - without floor plane

http://blitz.pp.ru/file/BlitzODE_0_5_b.rar


Sweenie(Posted 2004) [#126]
Hmm.
I'm having some problems with my trimesh(terrainmesh).
I can drive on it with my car without any problems but at one end(the same end all the time) of the terrain my car either falls through the terrain or sometimes it looks like it hits an invisible wall or something.
The mesh should be fine since I used the same mesh in the Tokamakversion of my cardemo.


Mustang(Posted 2004) [#127]
When i steer, my body nearly flips over and i cant seem to get the back wheels to slide


I think that it happens because the car wheels are spheres... never understud why they can't be cylinders? That would be more logical to me.

We had same kind of problems when I did the 3DMark2001 (playable) car demo - in the end we "solved" it by cheating: we added invisible weight that was below ground level and attached to the body, sort of rigid pendulum (if they can be such thing). It moved the center of mass lower and the car became more stable in hugh speed fast turns. :)

Oh and Arkon, great job (and fixes & additions)! "Easy composite objects" would be a must like Fredborg said... please?


Filax(Posted 2004) [#128]
I find strange that the objects are always moving (tremor) ??
Maybe i make an error?

Is there a way to define the physic precision like tokamak ?
TOKSIM_Advance Speed,Precision

I you don't understand what i say try this example :

http://www.blitz3dfr.com/tempo/TestODE.zip

But thanks for fix cylinder :)


Vorderman(Posted 2004) [#129]
I did exactly this with an ODE car test with my original DLL - added a sphere attached to a rigid joint way below the car - by varying the mass and distance you can get different results, although it does tend to start making the car rock from side to side after coming to a standstill, which looks a bit odd, but nothing you can't fix with some tweaking I'm sure.


Damien Sturdy(Posted 2004) [#130]
the engine has always worked with spheres and got around the "wheel hits wall" problem by using the High and Low lock to force the wheels to a certain angle. worked great before
but now when i steer, it makes the whole car jig, and the back wheels slide a small amount...

I have had my car datas for a while now and they worked before, tweaked for when the wheels could slide... it was pretty damn realistic... but now, looks like its crapped up...


Rob(Posted 2004) [#131]
For the weight trick, how do you do it? which joint is a "rigid" joint?

edit: I think I found out how. But now, how do we make the weight object non-collidable with everything?


Rob(Posted 2004) [#132]
BUG: invisible objects present at 0,0,0 (I think). It's a weird object and should not be there. This only happens when you load a trimesh for collision. The object wasn't there on an older version of the wrapper.

Invisible object bug.

Bug in latest version, not old version. With Trimesh.


Rob(Posted 2004) [#133]
MORE INFO: the bug occurs without trimesh. The invisible object is always at 0,0,0 I think.


Rob(Posted 2004) [#134]
Another bug: ODE_dGeomSetRotation does not seem to have any effect. ODE_dGeomGetRotation is missing as well.

ODE_dGeomSetRotation is essential because you cannot make custom collision shapes effectively without it.

Keep up the good work Arkon, when all the bugs are squashed then the world will have a perfect physics engine :)


Vorderman(Posted 2004) [#135]
I can't remember how you make the weight non-collidable - with Tokamak you just don't create the GEOMETRY object along with the rigid body - does ODE do a similar thing? It's been so long since I used it I can't recall how it works...


Rob(Posted 2004) [#136]
in tokamak I did actually create the geometry object. I just set it not to collide with a command.


Rob(Posted 2004) [#137]
I have a couple of questions:

* How do we know if we collide with the ground only as it's a bit confusing.

* How do you set the friction and bounce individually for each body? How do you set the friction and bounce for the trimesh?

Thanks :)


VIP3R(Posted 2004) [#138]

jhocking: Can you post the package as a zip?


Just to echo jhocking, can you post a zip version of the wrapper too please arkon? I can't get the rar package to decompress successfully here.


Rob(Posted 2004) [#139]
I have provided a zipped mirror for people having problems with rar files.

www.redflame.net/hosted/BlitzODE_0_5_b.zip


VIP3R(Posted 2004) [#140]
Thanks Rob, much appreciated :)


Rob(Posted 2004) [#141]
Bear in mind there is an invisible object at 0,0,0 in this release :) plus bugs with rotating geometry (shouldn't affect you) but bothersome for me :)


Paul "Taiphoz"(Posted 2004) [#142]
has all these updates been added to the main Zip yet ?

Im gona hold back a few days till all this stuff and the ideas above have been aded so I dont end up with missing files.


Rob(Posted 2004) [#143]
Yes it's all there. www.redflame.net/hosted/BlitzODE_0_5_b.zip
You may wish to hold back a few days, yes.


Damien Sturdy(Posted 2004) [#144]
im going to have to revert to a better compiled version of the old ode- this one works great but it just functions too different from my old engine...


VIP3R(Posted 2004) [#145]
OMG this is amazing, works much faster than tokamak for me.

Can't wait to get my head round this and implement it into my racing game.

Thanks arkon! :)

Rob, I will bear that stuff in mind and thanks again for the zip ;)

Mods can we have an BlitzODE sticky please?


Rob(Posted 2004) [#146]
Few problems:

- invisible object at origin bug
- small space between trimesh and rigid bodies bug
- cannot rotate geometry bug
- cannot check collisions with trimesh
- missing command to check if geometry is in a space
- few other missing commands

But very nice for 0.52b! Give the author time, I have every faith he will fix the problems if we support him :)


Damien Sturdy(Posted 2004) [#147]
Come on Arkon! coma on Arkon! ^.^

Bloodlocust: workaround for the space between meshs: increase the size of your visible mesh ;) sorry, had to say it.

needs fixing tho :)


Rob(Posted 2004) [#148]
Bloodlocust: workaround for the space between meshs: increase the size of your visible mesh ;) sorry, had to say it.
haha... except they then overlap each other. :)


Damien Sturdy(Posted 2004) [#149]
arrr, then i suppose its only a part fix :P


Paolo(Posted 2004) [#150]
Yahoooooooo!! :)

Oh man, this is the first time that I actually get to make something that moves similar to a car :)
Don't know why but I find this library much more simple to understand than tokamak,

have a look at this,
front wheels traction only:



Thanks again Arkon!
Paolo.


Proger(Posted 2004) [#151]
fixed bugs...
rotation geometry and body
invisible objects

userlib only
http://blitz.pp.ru/file/userlibs.rar


Wayne(Posted 2004) [#152]
Eurythmia
Wirh the new Akon bug fixes your example fails on:
Global space = ODE_dWorldCreate()

I tried Global space = ODE_dWorldCreate(1)
and it works.

8)


Proger(Posted 2004) [#153]
Global space = ODE_dWorldCreate(1)


BODYPRINT(Posted 2004) [#154]
I'm still getting the invisible object at 0,0,0.

But you are doing an awesome job arkon.
Thanks for devoting your time and knowledge on this for us all.


RepeatUntil(Posted 2004) [#155]
Does someone have an example to add a TriMesh into ODE?
I used the function from BlitzODE ODE_dTriMeshCreate%(myMesh), but no collision at all occur on myMesh?? All objects fall through it?
Is there something special to do here??


TheMan(Posted 2004) [#156]
arkon, thanks for your efforts
Eurythmia, thanks for sharing your car code I really liked it ...


Mustang(Posted 2004) [#157]
Does someone have an example to add a TriMesh into ODE?



Check the ODE_Tutorial_03_01 in the samples dir. Eurythmia, please edit and use "codebox" tag...


Proger(Posted 2004) [#158]
Car demo...
http://blitz.pp.ru/file/car_demo.zip


Rob(Posted 2004) [#159]
Fantastic, I think I love you arkon lol :)

One more question, how to decide if we have collided with the trimesh? a command perhaps? of course it is necessary for effects and such...

...thinking ahead, how do we make different parts of trimesh report different information?


Rob(Posted 2004) [#160]
Arkon:

*bug* Invisible object still exists at origin.

I discovered that you have included the old DLL so the bugs are the same... perhaps this was a mistake?


Proger(Posted 2004) [#161]
I will be testing that bugs.


Rob(Posted 2004) [#162]
Please check ODE_dGeomSetRotation is working correctly with cylinder geometry, thanks :)


Paul "Taiphoz"(Posted 2004) [#163]
that last car demo is a lot better, I think it rolls to easy though, a bit more rear wheel slide on it before it rolls and your onto a winner.

Im now gona use this as well for some of the projects im working on, so nice job.


Rob(Posted 2004) [#164]
You use an invisible weight under the car and/or translatemass to change the centre of gravity here. Too much rear slide will just prevent it moving properly.


Damien Sturdy(Posted 2004) [#165]
putting weight under a car is not realistic, therefore for better realism, find a better way, like reducing friction on the wheels.. even a slight reduction can be enough...

MAN i wish this wrapper would behave in my old ODE project >.<


Rob(Posted 2004) [#166]
your old ODE project is incorrect. This wrapper acts far closer to the real ODE, to the extent you can actually use the C documentation for it.

The invisible weight trick is actually a lot closer to the real dynamics of a car. A car will have several "invisible" weights - such as the engine at the front, a lighter body and a heavier chassis.

The golden rule for a car game must be that it behaves like the real thing. You CANNOT realistically make a cube and apply parameters as the weight distribution in a real car is all over the place. They also have different shocks/suspension/tyre pressure at the front and back. It's virtually impossible to get right, so the key is just to make it look right and feel right IMHO :)


Rob(Posted 2004) [#167]
Can someone confirm ODE_dGeomSetRotation is working on cylinders?


Damien Sturdy(Posted 2004) [#168]
@bloodlocust , yes, i know and understand it. il have to email you my old project at some point (or at least throw you a link)... i have PsycicParrots two cars and a selection of others driving round the track each with different suspention and weights.. etc etc etc... the handling on them was unbeleivable...

So, i suppose the question to help me convvert it over is:

How do i stop the wheels from being so grippy on the back? and also, when i steer.. it throws the body around. when i steer left, it steers, but the back end of the car gets nudged

Also, its still like i have superstick tyres.. i can turn around in a very small circle (tho i usually end up doing 2 wheel drive with my current sphere wheels).

Im more concerned about the latter. i just dont know what command to use to lessen the wheel stick. :)



Also, my old project alowed you to change the centre of gravity. And kay i nwas wrong, changing the location of the "invisible" weight does indeed help (hell, its why the subaru handles so brilliantly)... but it is still very possible to cock up with them.. ignote what i said because you could cock anything up anyway :)

You seem to know alot, hope you can help me with the sticky wheels problem :)

sorry, cant check cylinders- im not at any place to play with blitz atm :)


Rob(Posted 2004) [#169]
TranslateMass changes the centre of gravity.... Friction cannot be changed on a per-geometrty/body basis at the moment but you can change world friction. I am not familiar enough with it yet...

Going to check that stuff soon after arkon fixes the geometry rotation with cylinders (not body rotation) and the invisible object :)


Sweenie(Posted 2004) [#170]
From the ODE-manual...

dReal slip1,slip2 : The coefficients of force-dependent-slip (FDS) for friction directions 1 and 2. These are only set if the corresponding flags are set in mode.
FDS is an effect that causes the contacting surfaces to side past each other with a velocity that is proportional to the force that is being applied tangentially to that surface.

Consider a contact point where the coefficient of friction mu is infinite. Normally, if a force f is applied to the two contacting surfaces, to try and get them to slide past each other, they will not move. However, if the FDS coefficient is set to a positive value k then the surfaces will slide past each other, building up to a steady velocity of k*f relative to each other.

Note that this is quite different from normal frictional effects: the force does not cause a constant acceleration of the surfaces relative to each other - it causes a brief acceleration to achieve the steady velocity.

This is useful for modeling some situations, in particular tires. For example consider a car at rest on a road. Pushing the car in its direction of travel will cause it to start moving (i.e. the tires will start rolling). Pushing the car in the perpendicular direction will have no effect, as the tires do not roll in that direction. However - if the car is moving at a velocity v, applying a force f in the perpendicular direction will cause the tires to slip on the road with a velocity proportional to f*v (Yes, this really happens).

To model this in ODE set the tire-road contact parameters as follows: set friction direction 1 in the direction that the tire is rolling in, and set the FDS slip coefficient in friction direction 2 to k*v, where v is the tire rolling velocity and k is a tire parameter that you can chose based on experimentation.

Note that FDS is quite separate from the sticking/slipping effects of Coulomb friction - both modes can be used together at a single contact point.




Damien Sturdy(Posted 2004) [#171]
Thanks Sweenie.... ive tried Slip1+slip2 in the initialisation..... Il look more into it later.. this is realy the only problem.


Converting from the old ode to the new one has been a right pain! but ive dnoe it correctly- created commands very similar to Vorderman's (was it vorderman? sorry i cant remember ^.^) wrapper... it runs.

my god im having fun with this :D


Paul "Taiphoz"(Posted 2004) [#172]
THIS NEEDS A STICKY ADMINS>.... cmon. !!


slenkar(Posted 2004) [#173]
how do you disable gravity?

Also I noticed that when I disable the 'invisible floor' objects still hit something even though there is nothing there
But then it does go through the area where the floor would be.


BlitzSupport(Posted 2004) [#174]
OK, new thread... keep going Arkon!

http://www.blitzbasic.com/Community/posts.php?topic=38644