BlitzODE Physics Thread

Blitz3D Forums/Blitz3D Userlibs/BlitzODE Physics Thread

BlitzSupport(Posted 2004) [#1]
Time for a newer and stickier ODE thread!


Damien Sturdy(Posted 2004) [#2]
http://blitz.pp.ru/file/BlitzODE_0_5_b.rar

Right, well, nobody else seems to keep track of the latest file, so il post the one I know of here.

Wooo! ode rocks! now, im off to play with that skid info that Sweenie showed me!




Ps... cool, im the first one to post a reply ^>^


Rob(Posted 2004) [#3]
You must be really young :)


slenkar(Posted 2004) [#4]
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.


Damien Sturdy(Posted 2004) [#5]
heh, i just get very bored. i was sitting in the same chair all day without a break, 9-5.

@Slenkar: You disable gravity with ODE_dWorldSetGravity(0,0,0).


Roccia(Posted 2004) [#6]
I'm experimenting with this ODE Wrapper and I found that slip1 and slip2 constants are not defined in BlitzOde.bb

I think that dContactSlip1 and dContactSlip2 should be used instead in ODE_dSetContactMode() in order to enable ODE to take care of this tipe of friction model...or I'm wrong??


Damien Sturdy(Posted 2004) [#7]
I have it working. the functions are in there... o.O

Or am i misunderstanding?


jhocking(Posted 2004) [#8]
Can we please have the download as a zip file?


.rIKmAN.(Posted 2004) [#9]
I think some kind of "official" archive should be made too, there are loads of different versions with various fixes and whatnot, all very confusing for the beginner! :)


Tracer(Posted 2004) [#10]
yep, zip up all the stuff in one zip and release it :)

Tracer


Vorderman(Posted 2004) [#11]
Here is an old program I made with my original ODE DLL -
http://www.jameskett.dsl.pipex.com/BANGER.zip

It's not perfect because the old DLL used Blitz collisions to pass info to the ODE system, but with the new system it should be much better. Anyway, the car is quite fun to drive.

If anyone wants the source code I can post it up - it's no use to me as I'm working on my Ragdoll Rider game.






Rob(Posted 2004) [#12]
jhocking, I already zipped it in the other thread for you and the zip brigade :) www.redflame.net/hosted/BlitzODE_0_5_b.zip


slenkar(Posted 2004) [#13]
thanks Cygnus,

How do I stop force acting upon a body -set with dBodyAddForce?

I tried getting and setting the angular-momentum as in the car demos but my cube doesnt slow down after I apply the force.

Do I get the list of commands from the ODE website?




jhocking(Posted 2004) [#14]
Thanks!


wmaass(Posted 2004) [#15]
Neato, having fun! How would I go about getting the car to knock over this tree?? The tree is a mesh initialized with the CreateTriMesh function.





Sledge(Posted 2004) [#16]

Neato, having fun! How would I go about getting the car to knock over this tree??


At a guess, make an ODE cylinder of similar dimensions then alter the position and rotation of the mesh to match each frame. I wouldn't use the mesh's geometry - too complex and wasteful.


BlitzSupport(Posted 2004) [#17]
Ooh, Vorderman, post that source -- pretty please!


Damien Sturdy(Posted 2004) [#18]
ruiht now im tempted to post something old of me and a mates... but i think we will kep working on it....




Of course, id have to ask him first too.. that screenies not the best.

im questioning weather to start over with new ode or to continue trying to convert my old code. Its converted very well but the new ODE system seems very very different and it behaves differently.

I have also been unable to regenerate a car in the current one that does not steer funny.. the front wheels move one way, and while doing so, they push the back wheels a different way.

I know its possible cuz ive seen that truck demo!!! :)

[edit]
just realised how obvious it is who my mate is :)
[/edit]


Sledge(Posted 2004) [#19]

just realised how obvious it is who my mate is :)


GB=Garth Brooks, obviously. Hope he's not doing your music.


Rob(Posted 2004) [#20]
Lads can you verify the invisible object at 0,0,0 and rotatate geometry bugs?


Vorderman(Posted 2004) [#21]
here you go -
http://www.jameskett.dsl.pipex.com/banger_racing.bb

remember it's the old ODE interface and somewhat different to the current one, but perhaps the basic setup and car physics will transfer easily enough..?


Sledge(Posted 2004) [#22]

Lads can you verify the invisible object at 0,0,0 and rotatate geometry bugs?


I can verify the invisible object somewhat... each object exhibits a reaction the first time it tries to pass through that space, after which all is fine (hence I'm unsure if it really is an invisible object or some other glitch.)


EDIT: Fixed problem below. Simulator space needs to be initialised as global for trimesh creation to reference it... had overlooked this.

I'm being a bit dense at the moment... is there a command/parameter that activates collision between objects and the trimesh? I'm scouring the examples but I can't get this aspect up and running even though it looks like I've copied everything faithfully :P Must twiddle some more...


Vorderman(Posted 2004) [#23]
Cygnus - that screenie looks really nice to me - any chance of a demo program so we can see it moving?


Damien Sturdy(Posted 2004) [#24]
Il have a word.. it also uses the old ODE interface.. its incredibly stable for it but even a 95% stability isnt good enough-

Id like to get it running in ode 0.5 and this wrapper. its what im trying to do.. just has some wierd things i dont understand going on :)

If you read this, Mr P, what do you say?


Sledge(Posted 2004) [#25]
Is this a bug or proper behaviour? If I drop a couple of rigid bodies onto an animated body, when I begin to rotate the animated body the rigid bodies move with it and topple/roll as you'd expect. When I try the same thing with a trimesh, however, the rigid bodies fall through the mesh as it moves. Everything is fine if the mesh is still (ie reactions look accurate whatever the x/y/z angles of rotation) but once it's in motion the rigid bodies just slide through it. I'm repositioning the trimesh with ODE_dGeomSetRotation by the way, which has seemed to work okay with animated bodies so far.

EDIT: This is with the supplied 002.b3d mesh. Just so you know.


Tracer(Posted 2004) [#26]
Man, that new car behavior is bad... that truck rolls easier than a lubricated ball!

Tracer


Damien Sturdy(Posted 2004) [#27]
Not sure if this has anything to do with it:

Trimesh/Trimesh collisions, perform quite well, but there are three minor caveats:


The stepsize you use will, in general, have to be reduced for accurate collision resolution. Non-convex shape collision is much more dependent on the collision geometry than primitive collisions. Further, the local contact geometry will change more rapidly (and in a more complex fashion) for non-convex polytopes than it does for simple, convex polytopes such as spheres and cubes.

In order to efficiently resolve collisions, dCollideTTL needs the positions of the colliding trimeshes in the previous timestep. This is used to calculate an estimated velocity of each colliding triangle, which is used to find the direction of impact, contact normals, etc. This requires the user to update these variables at every timestep. This update is performed outside of ODE, so it is not included in ODE itself. The code to do this looks something like this:

  const double *DoubleArrayPtr =
    Bodies[BodyIndex].TransformationMatrix->GetArray();
  dGeomTriMeshDataSet( TriMeshData,
    TRIMESH_LAST_TRANSFORMATION,
    (void *) DoubleArrayPtr );

The transformation matrix is the standard 4x4 homogeneous transform matrix, and the "DoubleArray" is the standard flattened array of the 16 matrix values.







Basically, i think you have to keep updating the trimesh info... or just nothave trimeshes moving... imrealy not sure. ANyone help on this one?


Sledge(Posted 2004) [#28]
Coooo... where are those docs from? Thanks for the info, but I'm not totally inspired by "The code to do this looks something like this". SOMETHING like that?! :D

Would be nice to see this added as a function within BlitzODE.bb at some point - fully integrated trimeshes are the ideal. Of course, it's all gobbledeygook to me.


.rIKmAN.(Posted 2004) [#29]
I think I may leave off for a bit until all these teething problems are sorted out and I have a solid base to start from (stability, features, not beta etc) :)

It`ll be hard enough to just ise ODE, never mind try and deal with bugs and glitches along the way!

Freat work arkon, keep it up mate!! :D


Damien Sturdy(Posted 2004) [#30]
lol, i didnt write that of course, its from the ODE documents found over at www.ode.org.

I just put the code into a code box to make it look nicer.

IM still having problems with turning the wheels of my cars in this one. Anyone help here?


.rIKmAN.(Posted 2004) [#31]
I also think that there should be some Blitz style help that integrate into the F1 help, MUCH MUCH nicer than having to use the docs at ode.org.

I am willing to do it if no one else wants the task (ie. people with Cod2Doc + those who know how to do it already)

It should just be a case of ammending a few command names and pasting in the docs from ode.org, no?


Sledge(Posted 2004) [#32]

i didnt write that of course,


No I knew that! It's just that the section of www.ode.org that I've been looking at doesn't have that info. Incidentally, I tried a really simple trimesh (a box) rather than the undulating sample one and it exhibits the same problem so the complexity of the geometry seems not to matter.

EDIT: Actually, running the code a few more times reveals that it's prone to hanging when you start asking the simulation to handle rigid bodies against a moving trimesh... the non-trimesh code is still stable so it's almost certainly not the length of time my machine's been running.


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


RepeatUntil(Posted 2004) [#34]

I also think that there should be some Blitz style help that integrate into the F1 help, MUCH MUCH nicer than having to use the docs at ode.org.

I am willing to do it if no one else wants the task (ie. people with Cod2Doc + those who know how to do it already)

It should just be a case of ammending a few command names and pasting in the docs from ode.org, no?



I am OK to describe to whoever who wants how we can do that in Cod2Doc. It's not too difficult! BotBuilder already did it for Tokamak... Just ask me.


Zethrax(Posted 2004) [#35]
Here's a zip of the ODE version 0.5 docs from www.ode.org modified to use local filepaths. These may differ in some respects from Arkon's functions but they should be useful as a general guide.

http://www.brightrealm.com/REMOTE_FILES/ODE_v0.5_Docs.zip


Roccia(Posted 2004) [#36]
No friction on rolling objects???

Sorry for the stupid question, but I cannot understand this...

If i put a box on the plane and then apply a force to it, it will start moving and after a while will stop again, just because there is friction. This is the expected behaviour.

If I replace the cube with a sphere or cylinder, it starts rolling and never stop. Even if I set a very high friction value it will never stop. Why???

[EDIT] I've just downloaded all the ODE mailing list and I found that rolling friction is not modelled in ode, so we have to compute it by ourself :) Now things make sense [/EDIT]


Damien Sturdy(Posted 2004) [#37]
its pretty easy to compute realy.. just damp the rolling speed when the sphere has collided :)


Rob(Posted 2004) [#38]
The more friction a rolling object has, the MORE it will roll!
A rolling object will only stop rolling if:

- a force damps it
- it is sticky
- it's inerta finally runs out on a flat plane
- another force collides

Adding friction is crazy! it's the grip that causes the roll, so yes it's a stupid question because it is answered by looking at the behaviour of objects around you :)


Rob(Posted 2004) [#39]
How do you detect a collision with trimesh from an animated body?


Sledge(Posted 2004) [#40]
Re: The simulation hanging - I had switched to ODE_dWorldStep in the hopes that it would help fix the collision between rigid bodies and the trimesh, reverting back to ODE_dWorldQuickStep seems to stop the crashing.


RepeatUntil(Posted 2004) [#41]
I am not able to have collision between a normal body and a trimesh. I followed the example in ODE_Tutorial_03_01 to try to do that, but it failed because I am scaling my mesh (with ScaleMesh in Blitz).
If I change the code in ODE_Tutorial_03_01 and try to scale the mesh (before calling trimesh off course), then it fails as well (try it!).
How can I correct that? Is there a possibility to scale the geometry associated with the mesh??


Sledge(Posted 2004) [#42]

(try it!)


Already did... the TriMesh remains the original size, as you've discovered. I just made my original bigger in the editor... perhaps there's export code in the archives that will let you save out a scaled-up mesh from within Blitz instead?

Either that or you could try to scale the Trimesh as it's made by messing around with the ODE_dTriMeshCreate function. I don't see anything in the decls file that would be directly helpful.


Rob(Posted 2004) [#43]
Try this fixed code for creating trimesh. Pass it your level mesh.



Dreamora(Posted 2004) [#44]
for meshes you want to use as trimesh better use scalemesh instead of scaleentity. This way the actual vertex coordinates are modified not the objects matrix


Damien Sturdy(Posted 2004) [#45]
@ Vorderman.. did you update the wrapper at some point? cuz thats giving me a load of wierd stuff on my system (too many perameters etc etc etc)... it looks cool ^.^


Sledge(Posted 2004) [#46]

for meshes you want to use as trimesh better use scalemesh instead of scaleentity



That works great - should've thought to try it.


Rob(Posted 2004) [#47]
Also, look in misc 3d, code archives for EntityScale functions. Merely multiply by entity scale to give you the correct results.


Eric(Posted 2004) [#48]
I have a flat TriMesh. 32 x 32. My object bounces at 0,0,0 then eventually falls through. Has anyone had problems with this?


Sledge(Posted 2004) [#49]

I have a flat TriMesh. 32 x 32. My object bounces at 0,0,0 then eventually falls through. Has anyone had problems with this?



Move your TriMesh up... I think you will find the object is passing through it and hitting the phantom 0,0,0 object instead. When I couldn't get collision between rigid bodies and the TriMesh it was because I forgot to make the simulation space global.


Eric(Posted 2004) [#50]
Umm. Thanks but that doesn't seem to be the problem. Tri mesh seems to have holes in it somehow.. In Tokamak it works perfectly... I love how ODE operates but I can't for the life of me get my objects to consitently stay on the TriMesh. I have a object that is controlled with my joystick, applying various forces, I bump into cubes on the ground and sometimes they fall through.


Rob(Posted 2004) [#51]
There is still a bug with an invisible object at 0,0,0.

Please consider reading the old topic first before asking questions that may have been answered to save time and posts.


Sledge(Posted 2004) [#52]

I bump into cubes on the ground and sometimes they fall through.


Is autodisable off for each body? I don't know if it matters against the TriMesh, but it might. Is the TriMesh stationary?


RepeatUntil(Posted 2004) [#53]
@Bloodlocust: I tried you function (thanks) but that didn't work (both for my program or for the tutorial).

@Dreamora: I didn't use scaleEntity, but scaleMesh, and still it does not work...


elias_t(Posted 2004) [#54]
Here is an optimization I believe it has to be used when having many ode objects.
It shows how to use better the autodisable flags.




Damien Sturdy(Posted 2004) [#55]
Riteyo:

Were still working on our lil car project.
@Vorderman: Were keeping it under wraps for the time being, Email me or give me an email addy and il send you a link to a current copy. :)

We may let a demo thingy out at some point- it depends where it goes realy. :D


Vorderman(Posted 2004) [#56]
Cygnus: great, thanks - I'd really like to see what you're making - my home email address is jameskett@....

I assume you want it kept private at the moment?

In answer to your question I think I must have updated the wrapper because some of my old stuff works and some doesn't - it's possible that program used an older version.


Sledge(Posted 2004) [#57]

@Bloodlocust: I tried you function (thanks) but that didn't work (both for my program or for the tutorial).

@Dreamora: I didn't use scaleEntity, but scaleMesh, and still it does not work...


Have you renamed the simulation space? The TriMesh creation function is hard-coded to use the original name given in the tutorials and may trip people (ie me) up.


RepeatUntil(Posted 2004) [#58]
Have you renamed the simulation space?

No, I didn't rename the simulation space. It's called "space" and it's global in my program


Sledge(Posted 2004) [#59]

No, I didn't rename the simulation space. It's called "space" and it's global in my program



Have you got the Quadbike example there? That has working trimesh collision... try importing the example mesh and seeing if that works in your code. It will at least tell you whether it's your code or an anomally with the mesh that is causing the problem. If you don't get collisions with the example mesh then you're going to have to do a line by line comparison with the example code to see where yours differs.


Rob(Posted 2004) [#60]
well then you'll just have to start again from scratch.


wmaass(Posted 2004) [#61]
in the screenshot a ways up I loaded that mesh terrain created in FLE, seemed to work just fine.


Rob(Posted 2004) [#62]
:'( sob... sob.... arkon has left us...!


Damien Sturdy(Posted 2004) [#63]
um,huh?


Rob(Posted 2004) [#64]
um,huh?


.rIKmAN.(Posted 2004) [#65]
Gotta say the ODE community is a bit crap - is there only the mailing list from the offial site?


Sledge(Posted 2004) [#66]

is there only the mailing list from the offial site?



In the Wiki section is a link to a community forum.

http://ode.petrucci.ch/


.rIKmAN.(Posted 2004) [#67]
It has less than 100 posts on the entire forum!


Sledge(Posted 2004) [#68]
You asked, I told. :)


Rob(Posted 2004) [#69]
I posted there and got an instant response.


.rIKmAN.(Posted 2004) [#70]
Furry muff - guess every community grows from tiny acorns :)


Rob(Posted 2004) [#71]
ODE's been used in all sorts of stuff from high end modelling packages, xbox games, etc...

The author of ODE worked on mathengine... which became karma and powered the physics of unreal tournament 2004 AFAIK, so it's probably quite the thing :)

I would like arkon to fix the bugs, willing to donate if it means he'll work on it :)


.rIKmAN.(Posted 2004) [#72]
Ah right, do you know something we dont?
Has he stopped work on it now?

Hope not, he`s done a great job on the wrapper!


Wayne(Posted 2004) [#73]
Arkon rocks, hope he's not gone, he's done hell of good job here!


Sledge(Posted 2004) [#74]

well then you'll just have to start again from scratch.



I'm not so sure he will. Now I let my rigid bodies become inert I find them slipping through the TriMesh. I don't think the RB's in the examples ever actually come to a halt, much less against two faces on different axis. I'm not sure whether ODE is supposed to be able to handle such, but I'm probably going to fall back to animated bodies for the time being as behaviour seems infinitely more predictable there.


Proger(Posted 2004) [#75]
I don't stopped work on the wrapper... :)


RepeatUntil(Posted 2004) [#76]
Have you got the Quadbike example there?

No? What is the quadbike example???? Where can I find it??
Thanks!

Goods news that arkon is still working on the ODE wrapper!!


Sledge(Posted 2004) [#77]

No? What is the quadbike example???? Where can I find it??



From this thread: http://www.blitzbasic.com/Community/posts.php?topic=38506

It's the BlitzODE_Test.zip that CopperCircle linked I think.


.rIKmAN.(Posted 2004) [#78]
The link posted by CopperCircle is now dead...


Sledge(Posted 2004) [#79]

The link posted by CopperCircle is now dead...



Seeing as it has aleady been made publicly available I will host it for a few hours.

http://www.gamefreax.fsnet.co.uk/Downloads/BlitzODE_Test.zip


CopperCircle(Posted 2004) [#80]
Sorry, I had to make some room on my webspace to upload another project.


RepeatUntil(Posted 2004) [#81]
So, for the Trimesh problem, I tried to take the quadbike example, but this example has still the same problem. If you scale the mesh 0.1 instead of 1, then ODE doesn't take this into account. I guess there is something to modify in the function given by arkon to take into account the scale, but I am far from being a king in vertex/triangles programmation!!


Rob(Posted 2004) [#82]
Did you bother trying the fixed function posted previously?


Eric(Posted 2004) [#83]
I use TrueSpace..I had problems with Item fall through. Here is what I use I took a terragen Terrain and imported it into TrueSpace... I found that I had to flip all the triangles of the mesh to get the Trimesh to work right.


RepeatUntil(Posted 2004) [#84]
@BloodLocust: I quote myself from a previous post ;-)

@Bloodlocust: I tried you function (thanks) but that didn't work (both for my program or for the tutorial).


So, no, sorry, that was not working for me... Were you able to successfully use your modified function with a scale not equal to 1?
Thanks!


Sledge(Posted 2004) [#85]

So, for the Trimesh problem, I tried to take the quadbike example, but this example has still the same problem. If you scale the mesh 0.1 instead of 1, then ODE doesn't take this into account.



You must be doing something wrong. I got scaling working fine following the advice in this thread (scale mesh before passing it to ODE).

In the quadbike example replace this line...

ODE_CreateTriMesh(0,1.5,0,0,0,0,"002.b3d","forest.bmp")


...with this...

mesh = LoadMesh("002.b3d")
tex= LoadTexture("forest.bmp")
EntityTexture mesh,tex
RotateMesh mesh,-10,0,0
ScaleMesh mesh,.5,.5,.5
TriMesh = ODE_dTriMeshCreate(mesh)



RepeatUntil(Posted 2004) [#86]
Thank you, Sledge, it works for me now!! Hmmmm, I really don't understand what I was doing wrong... Sorry for that!


VIP3R(Posted 2004) [#87]
I'm was having some serious problems scaling and rotating static meshes here resulting in position & collision issues. I think Rob mentioned a rotation bug in the last thread?

As Sledge mentioned above, it seems to be very important to not only scale but also to rotate and position the mesh in the right order.

So for the benefit of anyone else having problems this order works for me:

mesh=LoadMesh(mesh$)
ScaleMesh mesh,1.4,2,1.8
RotateMesh mesh,90,0,-90
PositionMesh mesh,100,0,40
TriMesh=ODETriMeshCreate(mesh)

If you rotate after positioning instead of before, that also causes problems. Plus, note the use of ScaleMesh - don't use ScaleEntity it won't work properly.


Eric(Posted 2004) [#88]
With the current set up of ODE, It's very hard to determine which objects collide. In Tokamak, You can set whether Objects provide Feedback, Impulse, both or neither upon collision.

Is there anymore collision commands that are in ODE that still need to be added to The Blitz incarnation?

I was thinking that ODE would be a great replacement to Tokamak, but I am beginning to think that it would be nice to combine the capabilities of both.

Arkon are ya still out there? Are there more features your adding to ODE here on the Blitz side?


VIP3R(Posted 2004) [#89]
Eric, do you have these new collision handling commands posted by arkon?

http://playerfactory.proboards25.com/index.cgi?board=odedemos&action=display&num=1095645888


Eric(Posted 2004) [#90]
Yes I Do have these commands, I can resolve a collison between Lets Say My Ship Geom and the TriMesh.. Collision Counts have gone up as much as 20. Also on my Trimesh are a bunch of cubes we will call Cargo. I want to detect collision between my ship and the Cargo. Nothing I have tried seems to work. I have tried to do collision counts for the Cargo, but that is very slow. Any Ideas?


Rob(Posted 2004) [#91]
Basically, it's important for us to return the collided body or geometry of the other party. All we need are the handles as we can do the lookup stuff...


wizzlefish(Posted 2004) [#92]
Is this a community project or something?


.rIKmAN.(Posted 2004) [#93]
Yes and no.

arkon is working (brilliantly, I might add!) on the Blitz Wrapper but the source is available to modify.

Maybe it is an old version, but I`m sure its out there..


Wayne(Posted 2004) [#94]
It's great. I've been reading thru the manual and playing with the tutorials. Heck I'm even learning some about render tweening. I prefer delta T and have converted a few examples.

Thanks Arkon


Neochrome(Posted 2004) [#95]
NOOB-ATTACK: Where can i find the tutorials to ODE and simple learn by examples?


.rIKmAN.(Posted 2004) [#96]
There arent any proper examples and tutorials as such yet mate, but if you grab the wrapper there are examples that come with it which show how to do various things.

There are also the docs at www.ode.org


Wayne(Posted 2004) [#97]
I've modified the cart demo to support two carts, and I'm adding udp to make it multiuser. I was wondering what good stratagies there are for resolving physics running on two machines, or just running on one. Comments ?


Paul "Taiphoz"(Posted 2004) [#98]
Where is the most uptodate zip with all the above stuff added to it so I can download it.


VIP3R(Posted 2004) [#99]
Yavin, the latest zip is available from Rob's site:

www.redflame.net/hosted/BlitzODE_0_5_b.zip

@BloodLocust: Can you confirm what happens with the rotation bug you're getting?

Also, has anyone else experienced sudden pauses in the physics? It takes a while before it shows and lasts about 2 seconds then resumes as normal.


Damien Sturdy(Posted 2004) [#100]
yep! i have that. blitz continues running but ode stands still!


VIP3R(Posted 2004) [#101]
Ah, bugger :)

I was hoping it was a mistake on my part, that HAS to be fixed asap. Maybe a problem with the DLL passing data to and from Blitz? Is that something arkon will need to look into?


Damien Sturdy(Posted 2004) [#102]
duno what it is... but blitz doesnt freeze. all the rest of the items work, but ODE objects hang still :/


VIP3R(Posted 2004) [#103]
Yeah, that's exactly what happens here, damn I hope it can be fixed.


Damien Sturdy(Posted 2004) [#104]
me too

though at the moment, im still using the OLD ode now :D


Rob(Posted 2004) [#105]
The rotation bug is a simple rotate GEOMETRY bug. Create a cylinder geo and rotate that before adding it to the body.

It seems to have no effect at all.


Proger(Posted 2004) [#106]
I starting to make OGRE wrapper for BlitzBasic.
Want to know opinions about need in that.. :)

ODE will be include in this wrapper.

Thats is first mini-demo: blitz.pp.ru/file/BlitzOGRE.zip

Necessary to copy files in userlibs catalog to userlibs catalog of blitz.

Warning!!!
Don't run him in blitz-shell.
In this time works only exe compiling files.

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


Eric(Posted 2004) [#107]
Are you still working on ODE?


Proger(Posted 2004) [#108]
Yes


Wayne(Posted 2004) [#109]
Arkon,
I tried the demo and get the following message when trying to compile ==> function otest not found.

.. I removed the first line of code and compiled.

Says it can't find D3D9.dll

DX9 required for this ?

ODE Wrapper is fantastic.


Paul "Taiphoz"(Posted 2004) [#110]
Thats Nice.

I was planning to use this with blitz max, so getting an early shot of it in blitz3d will be good.


Mike0101(Posted 2004) [#111]
How can I use ODE with not built-in geometry-models (not cube or sphere)? I have a table with two chairs.

thanx


.rIKmAN.(Posted 2004) [#112]
Is anyone going to do some "proper" docs for this?
(ie. not www.ode.org - I mean specific B3D docs like Toka has)

Also any examples and tutorials?
I would be more than happy to host these if webspace is the problem?

Last but not least, does anyone fancy chattin on MSN about ODE, I`m online quite a lot and wouldn`t mind other peeps to experiment with.

Add me: rik187@...

Cheers!


bradford6(Posted 2004) [#113]
James Boyd. How bout a quick install blurb at beginning of thread.
1,2,3. how to install ODS and Wrapper. where to get it , etc...


Neochrome(Posted 2004) [#114]
how do i use a blitz Terrain with ODE? i dont under stand this much


.rIKmAN.(Posted 2004) [#115]
Is it possible to use ODE for some ragdoll physics?


VIP3R(Posted 2004) [#116]

Neomancer: how do i use a blitz Terrain with ODE? i dont under stand this much


I don't think it's possible, you would need to create a trimesh of the terrain so that ODE knows its geometry. But as a terrain isn't a mesh entity it won't create one. You will probably need to convert the terrain into a mesh somehow.

@ARKON: Do you think it will be possible to fix the ODE freezing problem? (ODE stops working at random for around 1 second, then continues again - see above posts)


wmaass(Posted 2004) [#117]
FYI FLE terrains work well.


VIP3R(Posted 2004) [#118]
Yeah, FLE doesn't create a Blitz terrain but it does create a mesh based on a heightmap (like Blitz terrains).

Neomancer, you could create a trimesh of the exported FLE mesh, that will work ok.


Neochrome(Posted 2004) [#119]
cool. next question. terrains useually big!!
i need a detailed terrain. Too many tris


.rIKmAN.(Posted 2004) [#120]
Is it possible to use ODE for some ragdoll physics?


does anyone know?


Rob(Posted 2004) [#121]
of course it is. Ragdoll is just joints and geometry... There are no special secrets other than what you imagine. You know how joints work, and of course rigid bodies.

Look at the examples, there's one that swings out a number of connected objects. Each of those can simply be arms and legs.


.rIKmAN.(Posted 2004) [#122]
Cheers Blood, I know its a newb question but I`m still learning all this physics malarkey.

I wish I had listened in Maths and Physics at school.. :)


Rob(Posted 2004) [#123]
yeah you don't need maths and fisics

all you need is a basic understanding of how things work. If tie a piece of string around a brick and swing it, what will happen?

in ODE, the brick is a rigid body, the string is a rigid body (or lots of them connected for realism).

And to connect them we simplify it with hinges and joints.


Paul "Taiphoz"(Posted 2004) [#124]
Id like to see some better examples of driving a car with ODE before I commit to a project.

in saying that though what we have just now is good.

Anyone got any arcade style car physics done that they would like to share ?


Wayne(Posted 2004) [#125]
whats left on the ODE wrapper ?
any outstanding issues left ?


VIP3R(Posted 2004) [#126]
RE: Cylinder geometry bug

Here is a workaround for the cylinder geometry rotation bug until arkon fixes the wrapper, it looks like the x plane is out by 90 degrees:

g.TODEGeom=New TODEGeom
g\body=ODE_dBodyCreate()
ODE_dBodySetRotation(g\body,0,0,0)
ODE_dBodySetPosition(g\body,20,20,20)
g\geom=ODE_dCreateCCylinder(space,4,8,10)
ODE_dGeomSetBody g\geom,g\body
g\mesh=CreateCylinder()
ScaleMesh g\mesh,4,8,4
RotateMesh g\mesh,90,0,0     ; <<<< FIX HERE
PositionMesh g\mesh,0,0,0

Rotate the mesh by 90 degrees (or -90), this will align the mesh to the cylinder geometry correctly, then use ODE_dBodySetRotation(g\body,0,0,0) to rotate the cylinder in your world space.


Clarks(Posted 2004) [#127]
From my experiments the lastest wrapper has x/z swapping.
I'll continue to add what commands has the problem.

ode_dbodyvectorfromworldx()
ode_dbodyvectorfromworldz()

ode_dbodygetlinearvelx()
ode_dbodygetlinearvelz()

ode_dbodycreatebox()

ode_dbodysetposition()


slenkar(Posted 2004) [#128]
can someone do a ragdoll physics demo please


.rIKmAN.(Posted 2004) [#129]
People giving up on ODE already?


Wayne(Posted 2004) [#130]
I'm working with it. Driving the cart around on some Martian terrain.


Paul "Taiphoz"(Posted 2004) [#131]
I'm still waiting to see if anyone is going to show a better example of car driving with it, but other than that Im working on something else with it.

I really wana see a good car example though.


Damien Sturdy(Posted 2004) [#132]
still, to this day, havent managed a car demo :( can do one piss easy with the old version!


VIP3R(Posted 2004) [#133]
I've got the ODE wrapper working ok with cars here, still needs some tweaking but it's not too bad.

It isn't ready for a demo yet though :(

Anyone seen arkon around? I'd like to know what can be done about the freezing physics thing...


Damien Sturdy(Posted 2004) [#134]
okay okay, ive got a demo, had one put together super quick, but, the physics just dont function right- like, friciton on the wheels, as ive said above, the back wheels move around when i steer making my car look like a fish out of water, yet the friction is set and when i drive, its super sticky... :/


VIP3R(Posted 2004) [#135]

Cygnus: the back wheels move around when i steer


I had that problem too, I think it's because the joints are coming apart.

Raising the 'world' error correction setting cured this for me...

Try adding ODE_dWorldSetERP(1) after your ODE_dWorldCreate(1) command.

Any chance of a new thread Mods? My 56K connection is creaking under the strain.


Damien Sturdy(Posted 2004) [#136]
im thinking you shouldnt set that to 1 ;)

Nope, that didnt fix it... Cheers anyhoo

Yeah, time for a new thread now? yup, cuz im struggling on this 567kb ADSL


VIP3R(Posted 2004) [#137]
That setting can range from 0.0 to 1.0 - it's at 0.2 by default.

Have you made sure you've set the stops on both of the rear joints?

ODE_dJointSetHinge2Param(joint,dParamLoStop,0)
ODE_dJointSetHinge2Param(joint,dParamHiStop,0)


Damien Sturdy(Posted 2004) [#138]
yup... thats not the sort of moving im talkin about... ode allows 0-1 but .1-.9 is best (thereabouts)...


.rIKmAN.(Posted 2004) [#139]
OMG! This page just took 1 second on my 1.5mb BB connection.
New thread at once! :)

PS. Where is arkon - is he still workin on it?
Seems he had a wrapper frenzy (ODE, OGRE etc) which seems to have died?


Wayne(Posted 2004) [#140]
Arkon,
Any scheduled tweaks to ODE planned soon ?


Damien Sturdy(Posted 2004) [#141]
Arkon was around earlier im sure :/


Damien Sturdy(Posted 2004) [#142]
burgh... :( im having zero luck with this car thingy

Could someone here (if they have already, post a link...) shove together a car demo? (not just the one that comes with ODE- that one suffers from all kindsa bugs.)

Ive got quite far with the engine but i just cant get my car creation routine to work. If i have some working code to look at i can learn. Id absolutely love to see that quadbike example code, that works a dream and its exactly what ive got with my old engine running with the old ODE wrapper. Never had any of these problems-

of course, im not saying the old one was better at all, no chance... im just struggling with the upgrade side of things :(


Proger(Posted 2004) [#143]
works with ODE lead with creating of Nebula2, so, as this powerfully interconnected


VIP3R(Posted 2004) [#144]
I've put together a simple car demo...

http://www.blitzbasic.com/codearcs/codearcs.php?code=1175


Damien Sturdy(Posted 2004) [#145]
Cheers, thsi should realy help me out on my conversion- Il have to do it later now mind- im at work atm!


Oh, and can we have ODE up in the tools pleae Admins?

And a link to a fresh, clean ZIP file would be nice in the top of this thread :/


Eric(Posted 2004) [#146]
I need more collision commands... Arkon, any chance?


Damien Sturdy(Posted 2004) [#147]
Heheh/. *big red face*


Peeps wana know what caused all my ODE hassle? its WORSE than what youd think.

I was being a total idiot.

lower the weight of my wheels and altered the suspention- this stopped the fishness :D Cheers to Vip3r- I studied his code and noticed the differences.
:D


Paul "Taiphoz"(Posted 2004) [#148]
nice one.

WE NEED MORE GOOD CAR CODE>


.rIKmAN.(Posted 2004) [#149]
RIP ODE :(


Wayne(Posted 2004) [#150]
Recycling some code for this jeep demo, Grab psionic jeep model first, then try it out.

http://www.psionic3d.co.uk/cgi-bin/imageFolio.cgi?direct=Free%20Stuff/3D%20Models


Graphics3D 800,600,16,1

Include "BlitzODE.bb"

Global Cvis=False
cmass#=150; chassis mass
tmass#=75 ; tire mass
ice=False


jeep=LoadMesh("jeep1.3ds")
ScaleEntity jeep,.4,.4,.4 
TranslateEntity jeep,0,-1.6,-1.5

cam=CreateCamera()
	PositionEntity cam,0,2,-8
	
l=CreateLight(2)
	PositionEntity l,-5,10,-5
	LightRange l,10
	
AmbientLight 200,200,200
 
pl=CreatePlane(16)
	EntityAlpha pl,.5
	texpl=CreateTexture(128,128,1+8)
	
Color 255,255,255

Rect 0,0,64,64,1
Rect 64,64,64,64,1
CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(texpl)
	ScaleTexture texpl,6,6
	EntityTexture pl,texpl,0,0
m=CreateMirror()

;---- Setting contact parameters ---
;ODE_dSetContactMode(dContactBounce + dContactSoftERP + dContactSoftCFM + dSlip1 + dSlip2)

ODE_dSetMU(.9); Friction  (smaller slippery)
ODE_dSetBOUNCE(.5)
ODE_dSetSOFT_ERP(.5)
ODE_dSetSOFT_CFM(.01)
;-------------------------------

;Crear un Espacio para ODE:
Global space = ODE_dWorldCreate(1)
;-------------------------------

;Chasis
ode_body1=ODE_dBodyCreate()
	geom=ODE_dCreateBox(space,.3,.5,4,10)
	ODE_dGeomSetBody geom,ode_body1
	
	ODE_dBodySetPosition ode_body1,0,4,-2
	ODE_dBodySetRotation ode_body1,0,0,0
	ODE_dBodySetMass ode_body1,cmass
vis1=CreateCube()
	ScaleEntity vis1,.15,.25,2
	EntityColor vis1,255,100,0
	
;rueda der
ode_body2=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body2
	
	ODE_dBodySetPosition ode_body2,2,3,0
	ODE_dBodySetRotation ode_body2,0,0,0
	ODE_dBodySetMass ode_body2,tmass
vis2=CreateCube()
	ScaleEntity vis2,.125,.5,.5
	EntityColor vis2,100,255,0
;rueda izq
ode_body3=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body3
	
	ODE_dBodySetPosition ode_body3,-2,3,0
	ODE_dBodySetRotation ode_body3,0,0,0
	ODE_dBodySetMass ode_body3,tmass
vis3=CreateCube()
	ScaleEntity vis3,.125,.5,.5
	EntityColor vis3,100,255,0

;Traseras
;rueda der
ode_body4=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body4
	
	ODE_dBodySetPosition ode_body4,2,3,-4
	ODE_dBodySetRotation ode_body4,0,0,0
	ODE_dBodySetMass ode_body4,tmass
vis4=CreateCube()
	ScaleEntity vis4,.125,.5,.5
	EntityColor vis4,0,0,255

;rueda izq
ode_body5=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body5
	
	ODE_dBodySetPosition ode_body5,-2,3,-4
	ODE_dBodySetRotation ode_body5,0,0,0
	ODE_dBodySetMass ode_body5,tmass
vis5=CreateCube()
	ScaleEntity vis5,.125,.5,.5
	EntityColor vis5,0,0,255

;Joints
joint1=ODE_dJointCreateBall()
	ODE_dJointAttach joint1,0,ode_body1
	
	ODE_dJointSetBallAnchor joint1,0,5,0
	
	;ODE_dJointSetUniversalAxis1 joint1,0,0,.1
	;ODE_dJointSetUniversalAxis2 joint1,1,0,0

suspension_hard#=8
suspension_soft#=.108 ; Increase to make shocks soft and springy

;rueda der
joint2=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint2,ode_body1,ode_body2

	ODE_dJointSetHinge2Anchor joint2,1.875,3,0
	ODE_dJointSetHinge2Axis1 joint2,0,1,0
	ODE_dJointSetHinge2Axis2 joint2,1,0,0

	ODE_dJointSetHinge2Param joint2,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint2,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint2,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint2,dParamSuspensionCFM,suspension_soft

;rueda izq
joint3=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint3,ode_body1,ode_body3

	ODE_dJointSetHinge2Anchor joint3,-1.875,3,0
	ODE_dJointSetHinge2Axis1 joint3,0,1,0
	ODE_dJointSetHinge2Axis2 joint3,1,0,0

	ODE_dJointSetHinge2Param joint3,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint3,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint3,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint3,dParamSuspensionCFM,suspension_soft

;Joints Traseros:
;rueda der
joint4=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint4,ode_body1,ode_body4

	ODE_dJointSetHinge2Anchor joint4,1.875,3,-4
	ODE_dJointSetHinge2Axis1 joint4,0,1,0
	ODE_dJointSetHinge2Axis2 joint4,1,0,0

	ODE_dJointSetHinge2Param joint4,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint4,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint4,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint4,dParamSuspensionCFM,suspension_soft
	
;rueda izq
joint5=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint5,ode_body1,ode_body5

	ODE_dJointSetHinge2Anchor joint5,-1.875,3,-4
	ODE_dJointSetHinge2Axis1 joint5,0,1,0
	ODE_dJointSetHinge2Axis2 joint5,1,0,0

	ODE_dJointSetHinge2Param joint5,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint5,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint5,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint5,dParamSuspensionCFM,suspension_soft
	

EntityParent jeep,vis1

;------- Create fixed box ----------

geom = ODE_dCreateBox(space, 15, .1, 25, 10)
ODE_dGeomSetPosition(geom, 40, 2.5, 0)
ODE_dGeomSetRotation(geom, 0, 0, 20)
mesh = CreateCube()
PositionEntity mesh, 40, 2.5, 0
RotateEntity mesh, 0, 0, 20
ScaleMesh mesh, .5, .05, .5
ScaleEntity mesh, 15, 1, 25

EntityAlpha vis1,cvis
EntityAlpha vis2,cvis
EntityAlpha vis3,cvis
EntityAlpha vis4,cvis
EntityAlpha vis5,cvis


millis#=MilliSecs()
millis2#=MilliSecs()
elapsed#=0


While Not KeyDown(1)

	millis=MilliSecs()-millis
	elapsed=millis
	millis=MilliSecs()

	ODE_dBodyEnable ode_body1
	ODE_dBodyEnable ode_body2
	ODE_dBodyEnable ode_body3
	
	mxs#=mxs#+(MouseXSpeed()-mxs#)/3
	mys#=mys#+(MouseYSpeed()-mys#)/3

	MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
	
	If KeyDown(203) Or KeyDown(205) Then
		mxs=0
	EndIf

	If KeyDown(200)
	ODE_dBodyAddRelTorque ode_body2,40,0,0
	ODE_dBodyAddRelTorque ode_body3,40,0,0
	EndIf
	If KeyDown(208)
	ODE_dBodyAddRelTorque ode_body2,-40,0,0
	ODE_dBodyAddRelTorque ode_body3,-40,0,0
	EndIf
	
	If mxs=0 Then
		angle#=Pi/4
	Else
		angle#=Pi/(80/Abs(mxs))
	EndIf
	

	
	If KeyDown(203) Or mxs<0
	ODE_dJointSetHinge2Param joint2,dParamLoStop,angle
	ODE_dJointSetHinge2Param joint2,dParamHiStop,angle

	ODE_dJointSetHinge2Param joint3,dParamLoStop,angle
	ODE_dJointSetHinge2Param joint3,dParamHiStop,angle
	
	ElseIf KeyDown(205) Or mxs>0
	
		ODE_dJointSetHinge2Param joint2,dParamLoStop,-angle
		ODE_dJointSetHinge2Param joint2,dParamHiStop,-angle
	
		ODE_dJointSetHinge2Param joint3,dParamLoStop,-angle
		ODE_dJointSetHinge2Param joint3,dParamHiStop,-angle
	
	Else
	ODE_dJointSetHinge2Param joint2,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint2,dParamHiStop,0;Pi/4

	ODE_dJointSetHinge2Param joint3,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint3,dParamHiStop,0;Pi/4
	EndIf

	
	If KeyHit(30)
		ODE_dJointAttach joint1,0,0
	EndIf
	
	If KeyHit(31)
		ODE_dJointAttach joint1,0,ode_body1
	EndIf
	
	; (I)ce
	If KeyHit(23) Then
		Ice=Not Ice
		If Ice Then
			ODE_dSetMU(.1);
		Else
			ODE_dSetMU(.9);
		End If
	End If
		
	If KeyHit(19) Then
		cvis=Not cvis
		EntityAlpha vis1,cvis
		EntityAlpha vis2,cvis
		EntityAlpha vis3,cvis
		EntityAlpha vis4,cvis
		EntityAlpha vis5,cvis
	End If

	;-------------
	PositionEntity vis1,ODE_dBodyGetPositionX(ode_body1),ODE_dBodyGetPositionY(ode_body1),ODE_dBodyGetPositionZ(ode_body1)
	RotateEntity vis1,ODE_dBodyGetPitch(ode_body1),ODE_dBodyGetYaw(ode_body1),ODE_dBodyGetRoll(ode_body1)

	PositionEntity vis2,ODE_dBodyGetPositionX(ode_body2),ODE_dBodyGetPositionY(ode_body2),ODE_dBodyGetPositionZ(ode_body2)
	RotateEntity vis2,ODE_dBodyGetPitch(ode_body2),ODE_dBodyGetYaw(ode_body2),ODE_dBodyGetRoll(ode_body2)

	PositionEntity vis3,ODE_dBodyGetPositionX(ode_body3),ODE_dBodyGetPositionY(ode_body3),ODE_dBodyGetPositionZ(ode_body3)
	RotateEntity vis3,ODE_dBodyGetPitch(ode_body3),ODE_dBodyGetYaw(ode_body3),ODE_dBodyGetRoll(ode_body3)

	PositionEntity vis4,ODE_dBodyGetPositionX(ode_body4),ODE_dBodyGetPositionY(ode_body4),ODE_dBodyGetPositionZ(ode_body4)
	RotateEntity vis4,ODE_dBodyGetPitch(ode_body4),ODE_dBodyGetYaw(ode_body4),ODE_dBodyGetRoll(ode_body4)

	PositionEntity vis5,ODE_dBodyGetPositionX(ode_body5),ODE_dBodyGetPositionY(ode_body5),ODE_dBodyGetPositionZ(ode_body5)
	RotateEntity vis5,ODE_dBodyGetPitch(ode_body5),ODE_dBodyGetYaw(ode_body5),ODE_dBodyGetRoll(ode_body5)
	;-------------

	ODE_dWorldQuickStep .1
	ODE_dWorldQuickStep .1
	
	;
	chase_cam_dist=15
	PointEntity cam,vis1
	ed#=EntityDistance(cam,vis1)
	If ed#>chase_cam_dist Then 
		MoveEntity cam,0,0,(ed#-chase_cam_dist)/2
		PositionEntity cam,EntityX(cam),EntityY(vis1)+5,EntityZ(cam)
		
	End If

	UpdateWorld
	
	If ice Then
		CameraClsColor cam,200,200,200
	Else
		CameraClsColor cam,0,0,128
	End If
	
	RenderWorld
	
;	Text 10,10,elapsed
;	Text 10,20,ODE_dBodyGetAngularVelX(ode_body2)
	Text 10,30,"press A to release the car attach"
	Text 10,40,"press S to force a re-attach of the car"
	Text 10,50,"press R to hide/show rigid body frame"
	Text 10,60,"Ice=" + ice
	text 10,70,"Steer Mouse or Arrow keys"	
	Text 10,80,"use ARROWS to move"
	
	Flip
Wend

ODE_dCloseODE()

MoveMouse 400,300:End



Wayne(Posted 2004) [#151]
Arkon, may we have the source code to the wrapper to remove the last two bugs aka cylinder and pausing?

Thanks


@rtur(Posted 2004) [#152]
this bugs already removed...


Damien Sturdy(Posted 2004) [#153]
oh, where linky? ^>^


@rtur(Posted 2004) [#154]
will be soon...


VIP3R(Posted 2004) [#155]

rIKmAN: RIP ODE :(


Stop doomsday'ing :) (if there is such a thing)


@rtur: this bugs already removed...


Good work, looking forward to testing it out.

<yell>How about a new thread please mods</yell>


Wayne(Posted 2004) [#156]
Get the jeep from above and check it out.
Ramp, lift dynamics to enhance jumps, mouse steering, and optional ice surface.

Hope the ODE pausing problem gets fixed soon because I'm really liking ODE.

Graphics3D 800,600,16,1

Include "BlitzODE.bb"

Global Cvis=False
cmass#=150; chassis mass
tmass#=75 ; tire mass
ice=False


jeep=LoadMesh("jeep1.3ds")
ScaleEntity jeep,.4,.4,.4 
TranslateEntity jeep,0,-1.6,-1.5

cam=CreateCamera()
	PositionEntity cam,0,2,-8
	
l=CreateLight(2)
	PositionEntity l,-5,10,-5
	LightRange l,10
	
AmbientLight 200,200,200
 
pl=CreatePlane(16)
	EntityAlpha pl,.5
	texpl=CreateTexture(128,128,1+8)
	
Color 255,255,255

Rect 0,0,64,64,1
Rect 64,64,64,64,1
CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(texpl)
	ScaleTexture texpl,6,6
	EntityTexture pl,texpl,0,0
m=CreateMirror()

;---- Setting contact parameters ---
;ODE_dSetContactMode(dContactBounce + dContactSoftERP + dContactSoftCFM + dSlip1 + dSlip2)

ODE_dSetMU(1.9); Friction  (smaller slippery)
ODE_dSetBOUNCE(.5)
ODE_dSetSOFT_ERP(.5)
ODE_dSetSOFT_CFM(.01)
;-------------------------------

;Crear un Espacio para ODE:
Global space = ODE_dWorldCreate(1)
;-------------------------------

;Chasis
ode_body1=ODE_dBodyCreate()
	geom=ODE_dCreateBox(space,.3,.5,4,10)
	ODE_dGeomSetBody geom,ode_body1
	
	ODE_dBodySetPosition ode_body1,0,4,-2
	ODE_dBodySetRotation ode_body1,0,0,0
	ODE_dBodySetMass ode_body1,cmass
vis1=CreateCube()
	ScaleEntity vis1,.15,.25,2
	EntityColor vis1,255,100,0
	
;rueda der
ode_body2=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body2
	
	ODE_dBodySetPosition ode_body2,2,3,0
	ODE_dBodySetRotation ode_body2,0,0,0
	ODE_dBodySetMass ode_body2,tmass
vis2=CreateCube()
	ScaleEntity vis2,.125,.5,.5
	EntityColor vis2,100,255,0
;rueda izq
ode_body3=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body3
	
	ODE_dBodySetPosition ode_body3,-2,3,0
	ODE_dBodySetRotation ode_body3,0,0,0
	ODE_dBodySetMass ode_body3,tmass
vis3=CreateCube()
	ScaleEntity vis3,.125,.5,.5
	EntityColor vis3,100,255,0

;Traseras
;rueda der
ode_body4=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body4
	
	ODE_dBodySetPosition ode_body4,2,3,-4
	ODE_dBodySetRotation ode_body4,0,0,0
	ODE_dBodySetMass ode_body4,tmass
vis4=CreateCube()
	ScaleEntity vis4,.125,.5,.5
	EntityColor vis4,0,0,255

;rueda izq
ode_body5=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body5
	
	ODE_dBodySetPosition ode_body5,-2,3,-4
	ODE_dBodySetRotation ode_body5,0,0,0
	ODE_dBodySetMass ode_body5,tmass
vis5=CreateCube()
	ScaleEntity vis5,.125,.5,.5
	EntityColor vis5,0,0,255

;Joints
joint1=ODE_dJointCreateBall()
	ODE_dJointAttach joint1,0,ode_body1
	
	ODE_dJointSetBallAnchor joint1,0,5,0
	
	;ODE_dJointSetUniversalAxis1 joint1,0,0,.1
	;ODE_dJointSetUniversalAxis2 joint1,1,0,0

suspension_hard#=8
suspension_soft#=.108 ; Increase to make shocks soft and springy

;rueda der
joint2=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint2,ode_body1,ode_body2

	ODE_dJointSetHinge2Anchor joint2,1.875,3,0
	ODE_dJointSetHinge2Axis1 joint2,0,1,0
	ODE_dJointSetHinge2Axis2 joint2,1,0,0

	ODE_dJointSetHinge2Param joint2,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint2,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint2,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint2,dParamSuspensionCFM,suspension_soft

;rueda izq
joint3=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint3,ode_body1,ode_body3

	ODE_dJointSetHinge2Anchor joint3,-1.875,3,0
	ODE_dJointSetHinge2Axis1 joint3,0,1,0
	ODE_dJointSetHinge2Axis2 joint3,1,0,0

	ODE_dJointSetHinge2Param joint3,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint3,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint3,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint3,dParamSuspensionCFM,suspension_soft

;Joints Traseros:
;rueda der
joint4=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint4,ode_body1,ode_body4

	ODE_dJointSetHinge2Anchor joint4,1.875,3,-4
	ODE_dJointSetHinge2Axis1 joint4,0,1,0
	ODE_dJointSetHinge2Axis2 joint4,1,0,0

	ODE_dJointSetHinge2Param joint4,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint4,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint4,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint4,dParamSuspensionCFM,suspension_soft
	
;rueda izq
joint5=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint5,ode_body1,ode_body5

	ODE_dJointSetHinge2Anchor joint5,-1.875,3,-4
	ODE_dJointSetHinge2Axis1 joint5,0,1,0
	ODE_dJointSetHinge2Axis2 joint5,1,0,0

	ODE_dJointSetHinge2Param joint5,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint5,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint5,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint5,dParamSuspensionCFM,suspension_soft
	

EntityParent jeep,vis1

;------- Create fixed box ----------

geom = ODE_dCreateBox(space, 15, .1, 25, 10)
ODE_dGeomSetPosition(geom, 40, 2.5, 0)
ODE_dGeomSetRotation(geom, 0, 0, 20)
mesh = CreateCube()
PositionEntity mesh, 40, 2.5, 0
RotateEntity mesh, 0, 0, 20
ScaleMesh mesh, .5, .05, .5
ScaleEntity mesh, 15, 1, 25
EntityColor mesh,255,255,0

EntityAlpha vis1,cvis
EntityAlpha vis2,cvis
EntityAlpha vis3,cvis
EntityAlpha vis4,cvis
EntityAlpha vis5,cvis


millis#=MilliSecs()
millis2#=MilliSecs()
elapsed#=0


While Not KeyDown(1)

	millis=MilliSecs()-millis
	elapsed=millis
	millis=MilliSecs()

	ODE_dBodyEnable ode_body1
	ODE_dBodyEnable ode_body2
	ODE_dBodyEnable ode_body3
	ODE_dBodyEnable ode_body4
	ODE_dBodyEnable ode_body5
	
	mxs#=mxs#+(MouseXSpeed()-mxs#)/3
	mys#=mys#+(MouseYSpeed()-mys#)/3

	MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
	
	If KeyDown(203) Or KeyDown(205) Then
		mxs=0
	EndIf

	If KeyDown(200)
	ODE_dBodyAddRelTorque ode_body2,40,0,0
	ODE_dBodyAddRelTorque ode_body3,40,0,0
	EndIf
	If KeyDown(208)
	ODE_dBodyAddRelTorque ode_body2,-40,0,0
	ODE_dBodyAddRelTorque ode_body3,-40,0,0
	EndIf
	
	If mxs=0 Then
		angle#=Pi/4
	Else
		angle#=Pi/(80/Abs(mxs))
	EndIf
	

	
	If KeyDown(203) Or mxs<0
	ODE_dJointSetHinge2Param joint2,dParamLoStop,angle
	ODE_dJointSetHinge2Param joint2,dParamHiStop,angle

	ODE_dJointSetHinge2Param joint3,dParamLoStop,angle
	ODE_dJointSetHinge2Param joint3,dParamHiStop,angle
	
	ElseIf KeyDown(205) Or mxs>0
	
		ODE_dJointSetHinge2Param joint2,dParamLoStop,-angle
		ODE_dJointSetHinge2Param joint2,dParamHiStop,-angle
	
		ODE_dJointSetHinge2Param joint3,dParamLoStop,-angle
		ODE_dJointSetHinge2Param joint3,dParamHiStop,-angle
	
	Else
	ODE_dJointSetHinge2Param joint2,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint2,dParamHiStop,0;Pi/4

	ODE_dJointSetHinge2Param joint3,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint3,dParamHiStop,0;Pi/4
	EndIf

	
	If KeyHit(30)
		ODE_dJointAttach joint1,0,0
	EndIf
	
	If KeyHit(31)
		ODE_dJointAttach joint1,0,ode_body1
	EndIf
	
	; (I)ce
	If KeyHit(23) Then
		Ice=Not Ice
		If Ice Then
			ODE_dSetMU(.1);
			
		Else
			ODE_dSetMU(1.9);
		End If
	End If
	
		
	
	If KeyHit(19) Then
		cvis=Not cvis
		EntityAlpha vis1,cvis
		EntityAlpha vis2,cvis
		EntityAlpha vis3,cvis
		EntityAlpha vis4,cvis
		EntityAlpha vis5,cvis
	End If

	;-------------
	PositionEntity vis1,ODE_dBodyGetPositionX(ode_body1),ODE_dBodyGetPositionY(ode_body1),ODE_dBodyGetPositionZ(ode_body1)
	RotateEntity vis1,ODE_dBodyGetPitch(ode_body1),ODE_dBodyGetYaw(ode_body1),ODE_dBodyGetRoll(ode_body1)

	PositionEntity vis2,ODE_dBodyGetPositionX(ode_body2),ODE_dBodyGetPositionY(ode_body2),ODE_dBodyGetPositionZ(ode_body2)
	RotateEntity vis2,ODE_dBodyGetPitch(ode_body2),ODE_dBodyGetYaw(ode_body2),ODE_dBodyGetRoll(ode_body2)

	PositionEntity vis3,ODE_dBodyGetPositionX(ode_body3),ODE_dBodyGetPositionY(ode_body3),ODE_dBodyGetPositionZ(ode_body3)
	RotateEntity vis3,ODE_dBodyGetPitch(ode_body3),ODE_dBodyGetYaw(ode_body3),ODE_dBodyGetRoll(ode_body3)

	PositionEntity vis4,ODE_dBodyGetPositionX(ode_body4),ODE_dBodyGetPositionY(ode_body4),ODE_dBodyGetPositionZ(ode_body4)
	RotateEntity vis4,ODE_dBodyGetPitch(ode_body4),ODE_dBodyGetYaw(ode_body4),ODE_dBodyGetRoll(ode_body4)

	PositionEntity vis5,ODE_dBodyGetPositionX(ode_body5),ODE_dBodyGetPositionY(ode_body5),ODE_dBodyGetPositionZ(ode_body5)
	RotateEntity vis5,ODE_dBodyGetPitch(ode_body5),ODE_dBodyGetYaw(ode_body5),ODE_dBodyGetRoll(ode_body5)
	;-------------

	ODE_dWorldQuickStep .1
	ODE_dWorldQuickStep .1
	
	;
	chase_cam_dist=15
	PointEntity cam,vis1
	ed#=EntityDistance(cam,vis1)
	If ed#>chase_cam_dist Then 
		MoveEntity cam,0,0,(ed#-chase_cam_dist)/2
		PositionEntity cam,EntityX(cam),EntityY(vis1)+5,EntityZ(cam)
		
	End If

	UpdateWorld
	
	If ice Then
		CameraClsColor cam,200,200,200
	Else
		CameraClsColor cam,0,0,128
	End If
	
	RenderWorld
	
	; Add lift if we are above this alt
	If EntityY(vis1)>3 Then
		ODE_dBodySetForce(ode_body1,0,650,0)
	EndIf
	
;	Text 10,10,elapsed
;	Text 10,20,ODE_dBodyGetAngularVelX(ode_body2)
	Text 10,30,"press A to release the car attach"
	Text 10,40,"press S to force a re-attach of the car"
	Text 10,50,"press R to hide/show rigid body frame"
	Text 10,60,"press I to hide/show Ice, Ice=" + ice
	
	Text 10,100,"ARROWS to move, steer, mouse steer"
	
	Flip
Wend

ODE_dCloseODE()

MoveMouse 400,300:End



@rtur(Posted 2004) [#157]
>Good work, looking forward to testing it out.
i'm not author of wrapper, but i'm from russian comunity too ;) so i know that ode wrapper currently has no bugs with freezing...
just wait some time...


Damien Sturdy(Posted 2004) [#158]
Linkylinkylinklinklink? :P

Has the "shaky collisions" bug been fixed also? ^.^


@rtur(Posted 2004) [#159]
I don't know nothing about "shaky collisions" bug...


Damien Sturdy(Posted 2004) [#160]
um, when you drive a car fast... the wheels seem to bounce off the floor realy quickly so it looks like its shaking.. IM sure someone posted about it above...


Wayne(Posted 2004) [#161]
check the ODE FAQ for stable simulation information and suggestions.

I'll just be happy to see the freezing go away. What causes the freezing ? Could it be garbage collection ??

If it's fixed can we have it ?

Must be the Russian winter has slowed things down..

Hope fix comes soon comrade.
8)


Damien Sturdy(Posted 2004) [#162]
its not the simulation cocking up. :Ponce it starts bumping a bit, it doesnt stop- even if i halt everything. Whats the chance of this being another case of blitz collision bug?


Wayne(Posted 2004) [#163]
Cygnus the Second, If it's the code I posted above it's all ODE, and NO BLITZ COLLISIONS INVOLVED. What speed is your machine ?


Wayne(Posted 2004) [#164]
Updated program to only call ODE physics code every 15ms.

Graphics3D 800,600,16,1

Include "BlitzODE.bb"

Global Cvis=False
cmass#=150; chassis mass
tmass#=80 ; tire mass
ice=False


jeep=LoadMesh("jeep1.3ds")
ScaleEntity jeep,.4,.4,.4 
TranslateEntity jeep,0,-1.6,-1.5

cam=CreateCamera()
	PositionEntity cam,0,2,-8
	
l=CreateLight(2)
	PositionEntity l,-5,10,-5
	LightRange l,10
	
AmbientLight 200,200,200
 
pl=CreatePlane(16)
	EntityAlpha pl,.5
	texpl=CreateTexture(128,128,1+8)
	
Color 255,255,255

Rect 0,0,64,64,1
Rect 64,64,64,64,1
CopyRect 0,0,128,128,0,0,BackBuffer(),TextureBuffer(texpl)
	ScaleTexture texpl,6,6
	EntityTexture pl,texpl,0,0
m=CreateMirror()

;---- Setting contact parameters ---
;ODE_dSetContactMode(dContactBounce + dContactSoftERP + dContactSoftCFM + dSlip1 + dSlip2)

ODE_dSetMU(1.9); Friction  (smaller slippery)
ODE_dSetBOUNCE(.5)
ODE_dSetSOFT_ERP(.5)
ODE_dSetSOFT_CFM(.01)
;-------------------------------

;Crear un Espacio para ODE:
Global space = ODE_dWorldCreate(1)
;-------------------------------

;Chassis
ode_body1=ODE_dBodyCreate()
	geom=ODE_dCreateBox(space,.3,.5,4,10)
	ODE_dGeomSetBody geom,ode_body1
	
	ODE_dBodySetPosition ode_body1,0,4,-2
	ODE_dBodySetRotation ode_body1,0,0,0
	ODE_dBodySetMass ode_body1,cmass
vis1=CreateCube()
	ScaleEntity vis1,.15,.25,2
	EntityColor vis1,255,100,0
	
	
;rueda der
ode_body2=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body2
	
	ODE_dBodySetPosition ode_body2,2,3,0
	ODE_dBodySetRotation ode_body2,0,0,0
	ODE_dBodySetMass ode_body2,tmass
vis2=CreateCube()
	ScaleEntity vis2,.125,.5,.5
	EntityColor vis2,100,255,0
;rueda izq
ode_body3=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body3
	
	ODE_dBodySetPosition ode_body3,-2,3,0
	ODE_dBodySetRotation ode_body3,0,0,0
	ODE_dBodySetMass ode_body3,tmass
vis3=CreateCube()
	ScaleEntity vis3,.125,.5,.5
	EntityColor vis3,100,255,0

;Traseras
;rueda der
ode_body4=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body4
	
	ODE_dBodySetPosition ode_body4,2,3,-4
	ODE_dBodySetRotation ode_body4,0,0,0
	ODE_dBodySetMass ode_body4,tmass
vis4=CreateCube()
	ScaleEntity vis4,.125,.5,.5
	EntityColor vis4,0,0,255

;rueda izq
ode_body5=ODE_dBodyCreate()
	;geom=ODE_dCreateBox(space,.25,1,1,10)
	geom=ODE_dCreateSphere(space,1,10)
	ODE_dGeomSetBody geom,ode_body5
	
	ODE_dBodySetPosition ode_body5,-2,3,-4
	ODE_dBodySetRotation ode_body5,0,0,0
	ODE_dBodySetMass ode_body5,tmass
vis5=CreateCube()
	ScaleEntity vis5,.125,.5,.5
	EntityColor vis5,0,0,255
	


;Joints
joint1=ODE_dJointCreateBall()
	ODE_dJointAttach joint1,0,ode_body1
	
	ODE_dJointSetBallAnchor joint1,0,5,0
	
	;ODE_dJointSetUniversalAxis1 joint1,0,0,.1
	;ODE_dJointSetUniversalAxis2 joint1,1,0,0

suspension_hard#=8
suspension_soft#=.15 ; Increase to make shocks soft and springy

;Roll cage
;joint0=ODE_dJointCreateFixed()
;	ODE_dJointAttach joint0,ode_body1,ode_body6

	
;rueda der
joint2=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint2,ode_body1,ode_body2

	ODE_dJointSetHinge2Anchor joint2,1.875,3,0
	ODE_dJointSetHinge2Axis1 joint2,0,1,0
	ODE_dJointSetHinge2Axis2 joint2,1,0,0

	ODE_dJointSetHinge2Param joint2,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint2,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint2,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint2,dParamSuspensionCFM,suspension_soft

;rueda izq
joint3=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint3,ode_body1,ode_body3

	ODE_dJointSetHinge2Anchor joint3,-1.875,3,0
	ODE_dJointSetHinge2Axis1 joint3,0,1,0
	ODE_dJointSetHinge2Axis2 joint3,1,0,0

	ODE_dJointSetHinge2Param joint3,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint3,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint3,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint3,dParamSuspensionCFM,suspension_soft

;Joints Traseros:
;rueda der
joint4=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint4,ode_body1,ode_body4

	ODE_dJointSetHinge2Anchor joint4,1.875,3,-4
	ODE_dJointSetHinge2Axis1 joint4,0,1,0
	ODE_dJointSetHinge2Axis2 joint4,1,0,0

	ODE_dJointSetHinge2Param joint4,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint4,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint4,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint4,dParamSuspensionCFM,suspension_soft
	
;rueda izq
joint5=ODE_dJointCreateHinge2()
	ODE_dJointAttach joint5,ode_body1,ode_body5

	ODE_dJointSetHinge2Anchor joint5,-1.875,3,-4
	ODE_dJointSetHinge2Axis1 joint5,0,1,0
	ODE_dJointSetHinge2Axis2 joint5,1,0,0

	ODE_dJointSetHinge2Param joint5,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint5,dParamHiStop,0;Pi/4
	ODE_dJointSetHinge2Param joint5,dParamSuspensionERP,suspension_hard
	ODE_dJointSetHinge2Param joint5,dParamSuspensionCFM,suspension_soft

	

EntityParent jeep,vis1

;------- Create fixed box ----------

geom = ODE_dCreateBox(space, 15, .1, 35, 10)
ODE_dGeomSetPosition(geom, 40, 2.5, 0)
ODE_dGeomSetRotation(geom, 0, 0, 20)
mesh = CreateCube()
PositionEntity mesh, 40, 2.5, 0
RotateEntity mesh, 0, 0, 20
ScaleMesh mesh, .5, .05, .5
ScaleEntity mesh, 15, 1, 35

EntityAlpha vis1,cvis
EntityAlpha vis2,cvis
EntityAlpha vis3,cvis
EntityAlpha vis4,cvis
EntityAlpha vis5,cvis


millis#=MilliSecs()
elapsed#=millis#-millis2#
millis2#=millis1#


While Not KeyDown(1)

	millis1=MilliSecs()
	elapsed=millis1-millis
	millis=millis1

	ODE_dBodyEnable ode_body1
	ODE_dBodyEnable ode_body2
	ODE_dBodyEnable ode_body3
	ODE_dBodyEnable ode_body4
	ODE_dBodyEnable ode_body5
		
	
	mxs#=mxs#+(MouseXSpeed()-mxs#)/3
	mys#=mys#+(MouseYSpeed()-mys#)/3

	MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
	
	If KeyDown(203) Or KeyDown(205) Then
		mxs=0
	EndIf

	If KeyDown(200)
	ODE_dBodyAddRelTorque ode_body2,40,0,0
	ODE_dBodyAddRelTorque ode_body3,40,0,0
	EndIf
	If KeyDown(208)
	ODE_dBodyAddRelTorque ode_body2,-40,0,0
	ODE_dBodyAddRelTorque ode_body3,-40,0,0
	EndIf
	
	If mxs=0 Then
		angle#=Pi/4
	Else
		angle#=Pi/(90/Abs(mxs))
	EndIf
	

	
	If KeyDown(203) Or mxs<0
	ODE_dJointSetHinge2Param joint2,dParamLoStop,angle
	ODE_dJointSetHinge2Param joint2,dParamHiStop,angle

	ODE_dJointSetHinge2Param joint3,dParamLoStop,angle
	ODE_dJointSetHinge2Param joint3,dParamHiStop,angle
	
	ElseIf KeyDown(205) Or mxs>0
	
		ODE_dJointSetHinge2Param joint2,dParamLoStop,-angle
		ODE_dJointSetHinge2Param joint2,dParamHiStop,-angle
	
		ODE_dJointSetHinge2Param joint3,dParamLoStop,-angle
		ODE_dJointSetHinge2Param joint3,dParamHiStop,-angle
	
	Else
	ODE_dJointSetHinge2Param joint2,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint2,dParamHiStop,0;Pi/4

	ODE_dJointSetHinge2Param joint3,dParamLoStop,0;-Pi/4
	ODE_dJointSetHinge2Param joint3,dParamHiStop,0;Pi/4
	EndIf

	
	If KeyHit(30)
		ODE_dJointAttach joint1,0,0
	EndIf
	
	If KeyHit(31)
		ODE_dJointAttach joint1,0,ode_body1
	EndIf
	
	; (I)ce
	If KeyHit(23) Then
		Ice=Not Ice
		If Ice Then
			ODE_dSetMU(.1);
		Else
			ODE_dSetMU(1.8);
		End If
	End If
		
	If KeyHit(19) Then
		cvis=Not cvis
		EntityAlpha vis1,cvis
		EntityAlpha vis2,cvis
		EntityAlpha vis3,cvis
		EntityAlpha vis4,cvis
		EntityAlpha vis5,cvis
	End If

	;-------------
	PositionEntity vis1,ODE_dBodyGetPositionX(ode_body1),ODE_dBodyGetPositionY(ode_body1),ODE_dBodyGetPositionZ(ode_body1)
	RotateEntity vis1,ODE_dBodyGetPitch(ode_body1),ODE_dBodyGetYaw(ode_body1),ODE_dBodyGetRoll(ode_body1)

	PositionEntity vis2,ODE_dBodyGetPositionX(ode_body2),ODE_dBodyGetPositionY(ode_body2),ODE_dBodyGetPositionZ(ode_body2)
	RotateEntity vis2,ODE_dBodyGetPitch(ode_body2),ODE_dBodyGetYaw(ode_body2),ODE_dBodyGetRoll(ode_body2)

	PositionEntity vis3,ODE_dBodyGetPositionX(ode_body3),ODE_dBodyGetPositionY(ode_body3),ODE_dBodyGetPositionZ(ode_body3)
	RotateEntity vis3,ODE_dBodyGetPitch(ode_body3),ODE_dBodyGetYaw(ode_body3),ODE_dBodyGetRoll(ode_body3)

	PositionEntity vis4,ODE_dBodyGetPositionX(ode_body4),ODE_dBodyGetPositionY(ode_body4),ODE_dBodyGetPositionZ(ode_body4)
	RotateEntity vis4,ODE_dBodyGetPitch(ode_body4),ODE_dBodyGetYaw(ode_body4),ODE_dBodyGetRoll(ode_body4)

	PositionEntity vis5,ODE_dBodyGetPositionX(ode_body5),ODE_dBodyGetPositionY(ode_body5),ODE_dBodyGetPositionZ(ode_body5)
	RotateEntity vis5,ODE_dBodyGetPitch(ode_body5),ODE_dBodyGetYaw(ode_body5),ODE_dBodyGetRoll(ode_body5)
	
	;PositionEntity vis6,ODE_dBodyGetPositionX(ode_body6),ODE_dBodyGetPositionY(ode_body6),ODE_dBodyGetPositionZ(ode_body6)
	;RotateEntity vis6,ODE_dBodyGetPitch(ode_body6),ODE_dBodyGetYaw(ode_body6),ODE_dBodyGetRoll(ode_body6)

	;-------------

	PrimeTime#=PrimeTime+elapsed#
	If PrimeTime#>15 Then 
		Ptime1#=MilliSecs()
		ODE_dWorldQuickStep .1
		ODE_dWorldQuickStep .1
		Ptime2#=MilliSecs()
		PrimeTime#=PrimeTime#-15
	End If
			
	;
	chase_cam_dist=15
	PointEntity cam,vis1
	ed#=EntityDistance(cam,vis1)
	If ed#>chase_cam_dist Then 
		MoveEntity cam,0,0,(ed#-chase_cam_dist)/2
		PositionEntity cam,EntityX(cam),EntityY(vis1)+5,EntityZ(cam)
		
	End If

	UpdateWorld
	
	If ice Then
		CameraClsColor cam,200,200,200
	Else
		CameraClsColor cam,0,0,128
	End If

	If EntityY(vis1)>4 Then
		ODE_dBodyAddForce(ode_body1, 0,650,0)
	EndIf	
	
	RenderWorld
	
	
	Text 10,10,"Time: "+ elapsed# + "ms" 
	Text 10,20,"Ang Vel: " + ODE_dBodyGetAngularVelX(ode_body2)
	Text 10,30,"press A to release the car attach"
	Text 10,40,"press S to force a re-attach of the car"
	Text 10,50,"press R to hide/show rigid body frame"
	Text 10,60,"Ice=" + ice
	Text 10,70,"Hgt: " + EntityY(vis1)	
	Text 10,90,"Physics Time: " + Str(Ptime2#-Ptime1#) + "ms"
	Text 10,100,"use ARROWS to move"
	
	If elapsed>max_elapsed Then
		max_elapsed=elapsed
	EndIf
	
	Flip
Wend

ODE_dCloseODE()

MoveMouse 400,300:End




Wayne(Posted 2004) [#165]
.


Damien Sturdy(Posted 2004) [#166]
Nah its not youre code playing up... ive written my own car code- and youre right. it does appear that im using blitz collisions along with the ODE ones.. fixed now. cheers for the lil hint there.. :D


Wayne(Posted 2004) [#167]
I went and examined the ODE examples and noticed:
dWorldStep (world,0.05);

// remove all contact joints
dJointGroupEmpty (contactgroup);

So is ODE is freezing because we are not emptying the contact joints, and triggering some kind of garbage collection?

Do we need the following?
Global contactgroup=ODE_dJointGroupCreate(0)

and place this after the world step ?
ODE_dJointGroupEmpty(contactgroup)

Just thinking out loud here. hehe


Wayne(Posted 2004) [#168]
When can we see a new demo without ODE freezing ?


Wayne(Posted 2004) [#169]
Arkon,

I read ODE license, and it's my understanding if you modify the ODE library and distribute it with your product which is free or fee, your required to provide the modified source code to the ODE Library.

For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

Entire license here:
http://opensource.org/licenses/lgpl-license.php


Just a FYI


Wayne(Posted 2004) [#170]
Please post update without the freezing bug..


.rIKmAN.(Posted 2004) [#171]
RIP ODE x2 :(


Wayne(Posted 2004) [#172]
Pretty Sad, Looked like it was 99 percent done too.
I'm heading over to Tokamak country.

The way ARKON coded the ODE wrapper violates the ODE license by not providing the modified ODE Library source.


.rIKmAN.(Posted 2004) [#173]
Think I`ll use Toka too....though not for anything to do with cars - which is why I used ODE to begin with.

*sigh*


Damien Sturdy(Posted 2004) [#174]
jeez. ODE is NOT DEAD!


Wayne(Posted 2004) [#175]
@rtur,
I tried to email you but your email domain name does not exist.


Paul "Taiphoz"(Posted 2004) [#176]
Im sure there are a few people out there using this right now for cool projects.

I'm wondering if any of them would want to pop in the thread and show us what it is ?

I hope work on this continues.


CopperCircle(Posted 2004) [#177]
All the physics in my WorldStorm Engine are done via ODE, it is very functional:

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


Clarks(Posted 2004) [#178]
its a damn shame. it really is.


Proger(Posted 2004) [#179]
I plan to sell the ODE wrapper together with all rights and source codes.
Those whom it interests, I ask to write on arkon@... and duplicate on arkon@....


Paul "Taiphoz"(Posted 2004) [#180]
/me wont be doing that then..

I think I'll just stick with the current wrapper I have and be thankfull it took this long before you chose to sell it.

Can you sell it ??

/me goes off to find the tor from the creators of ode


Proger(Posted 2004) [#181]
I want to sell wrapper with all rights on his sale, use, etc. behind details write me on arkon@...


VIP3R(Posted 2004) [#182]
Yavin, where can I find the current wrapper you've mentioned? Did you compile it yourself?


Barliesque(Posted 2004) [#183]
@Arkon: Unfortunately, you are now competing with your own previous free releases. I don't think it's wrong at all for you to charge something for your efforts, but you should probably keep it as inexpensive as you can. Remember, you are also competing with the Tokamak wrapper. I would also suggest setting a fee publicly rather than trying to negotiate privately.

To ALL who would rather just use a previous release: As long as he keeps his fee low, I think we're all better off supporting Arkon's efforts. Hopefully, he will continue to support the wrapper as ODE continues to develop.


Rogue Vector(Posted 2004) [#184]
Request...

Beginner Tutorials - like your explaining it to a nine year old, and function descriptions.

Regards,

Rogue Vector


V(Posted 2004) [#185]
1) WHY is he trying to sell the wrapper?
2) Why not just finish the damn thing?
3) He does NOT have to give out the source code! Whoever said that can't read!

The license page of ODE allows one to use either the BSD license or the LGPL license. The LGPL license is evil. The BSD license allows you to distribute the binaries without the code, but you must include the credits and the file below:

BSD License
Open Dynamics Engine
Copyright (c) 2001-2004, Russell L. Smith.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.


I'm sick of seeing 99% of the projects not getting finished. Just fix the freezing in the physics engine and it's done! And it's legal! And you don't have to give out source code!


VIP3R(Posted 2004) [#186]

Just fix the freezing in the physics engine and it's done!


I suspect that 'bug' was put in intentionally to prevent anyone from making full use of the wrapper until the 'commercial' version was released.

Arkon did a great job with the wrapper and it will be a real shame if the Blitz community never gets the chance to use it to its full potential. Just imagine how Blitz would shine if only it was usable, I'm gutted tbh.


V(Posted 2004) [#187]
There's nothing wrong or shameful about getting paid for one's work. Especially if making games or tools for Blitz3D users is what the guy wants to do for a living.

If a guy is making development tools, why NOT pay him and support his efforts? "Oh no, he might eventually make a living off of this!" Is it very bad to make a living off of something that is fun just because nobody else can make the same wrapper?

I still would like to see this finished and supported for whatever money it would cost, just like I would like to see more cool Blitz3D games finished and released.


VIP3R(Posted 2004) [#188]
Erm, I never said I don't think Arkon should be paid for his work V, if he wants to go that way that's up to him.

Also, Arkon isn't the only one here capable of wrapping ODE btw.


V(Posted 2004) [#189]
Capable and finished are not the same things, to repeat my point :)


JoshK(Posted 2004) [#190]
What? So ODE isn't even functional in Blitz at this point?


ICECAP(Posted 2004) [#191]
Is there a reason none of the samples work, do i have to declare the ode dll somewhere in blitz3d or something?

Sorry never used dll addons before.


JaviCervera(Posted 2004) [#192]
You have to copy the .decls and .dll files in the "userlibs" folder of Blitz3D. You also have to distribute the .dll with each .exe you make that use its functions.


VIP3R(Posted 2004) [#193]

So ODE isn't even functional in Blitz at this point?


Yes and no, it works fine most of the time but there is an intermittent freezing of the physics, making the wrapper mostly unusable in its current form. This 'bug' was said to have been fixed, but not released.


wizzlefish(Posted 2005) [#194]
OK, I've got a question....

I'm just beginning to use ODE, and I'm planning to use it in a beta of my game. I couldn't find a well-documented tutorial of how to fix my problem.

I have that jeep mesh from above, and in that demo, I just substituted that plane for my "Arctic" level. The jeep just goes straight through the terrain, it doesn't even go up the hill.

So I need to fix this. In his code above, how would I take a non-BlitzTerrain with that plane?

And I tried copying that code to my own program, but it says "Variable type mismatch" and highlights where I global "dParamHiStop" and "dParamLoStop." How would I fix this?


JoshK(Posted 2005) [#195]
That Arkon guy offerec to sell me the source, which I wasn't interested in, because of the existing bugs...makes me think the code isn't very good.

I'm having a couple of people look at compiling a new dll, and I told them they can probably make a few bucks off of, but I will try to tell them to keep the price low. If they just sold it at $10 a pop (for the work of setting ODE up as a DLL) a lot of people would buy it.


Wayne(Posted 2005) [#196]
I'd buy a bug free DLL in a heartbeat. I like the way ODE works. Once you get hooked on ODE you want it.

8)


Mustang(Posted 2005) [#197]
$10? I'll buy two if you can make 100% perfect ODE DLL.


PsychicParrot(Posted 2005) [#198]
Too right. I'll buy two at that price as well!! :D


JaviCervera(Posted 2005) [#199]
I've spent most part of the weekend wrapping ODE in a dl suitable for use in Blitz. It only needs some last touches and that's all. 10€ looks like a reasonable price for it.


Wayne(Posted 2005) [#200]
Lets take that bad boy out for a test drive.


wizzlefish(Posted 2005) [#201]
I'm gonna buy it - as soon as I figure ODE out.


VIP3R(Posted 2005) [#202]
Jeez, ODE has more lives than a cat! :)

I was almost ready to abandon the ODE route and try something else instead.

How long do you think it will be before a demo/full version is available Jedive?

And how stable is it?


JaviCervera(Posted 2005) [#203]
It is ready, but I am just playing with it a bit before release. In fact, it is currently available, but I won't give the purchase link yet. Give me one day or two ;)


Wayne(Posted 2005) [#204]
I'm ready, I'll even make some demos that Halo can understand.

8)


Mustang(Posted 2005) [#205]
Hey, cool news! Thimbs up, Jedive. Let us know when you have the final version available. Have you done complete set of ODE functions, or is this limited set or something?


JaviCervera(Posted 2005) [#206]
Complete except for some maths commands which deal with matrices and quaternions (no need of them as I have replaced the rotation commands to use Euler Angles as in Blitz), and some stuff that cannot be used in Blitz like functions callbacks. Collision is done in ODE through a function callback. This function is called by ODE for each pair of geometric objects that collide. The important thing of this functions is the bounce, mu... parameters you use to calculate collision. I have written a standard callback function for the collisions and you can configure the parameters in Blitz. I think that the Arkon wrapper works in a similar way, altohugh I haven't used it too much.


Wayne(Posted 2005) [#207]
Can you make a free version that has limits or something so we can have it now, or do we have to wait till it's frosted and everything ?

Can't wait to see how it turns out.

Thanks


VIP3R(Posted 2005) [#208]
Sounds like you've done a good job there Jedive :)

When you are ready to release it, could you start a new thread (BlitzODE Physics Thread 2???) and ask the mods to sticky it? Assuming you call it BlitzODE of course ;)

This thread length is now ridiculous @200+ posts. It would be better to start a new one as this is a totally new wrapper.


JaviCervera(Posted 2005) [#209]
Ok, here it is!

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


Proger(Posted 2005) [#210]
For everybody who wants to help in http://ag-tools.com development and to help BlitzODE and BasicGL development group here is a link: http://www.ag-tools.com/donate/

Sure as a token of gratitude everyone will receive BlitzODE without freeze (with source code)... :)


flying willy(Posted 2005) [#211]
Did you fix the invisible object bug?


Proger(Posted 2005) [#212]
Yes.


Erroneouss(Posted 2005) [#213]
Yay!


flying willy(Posted 2005) [#214]
Sent a donation but no source to look at? :)


Proger(Posted 2005) [#215]
Please send me the payment details by my e-mail.


flying willy(Posted 2005) [#216]
Sent but still no reply.


miltos(Posted 2005) [#217]
Hi everybody.
I am new to Blitz 3D and to ODE Physics. I would like to ask if anybody knows if there is any tutorial or some other topic explaining the positioning of objects, sizing, scaling of 3D objects.
Being more specific i want to know the working path of creating a 3D object in some program like (3DS Mac, lightwave or any other, then loading this object in Blitz and putting ODE objects on it).
Which are the coordinates and sizes of ODE rigid bidies on it, how big must be, and then begin to place the links.
Is there any pipeline like this for 3DS uders explaining the above process?


puki(Posted 2005) [#218]
In relation to this:

Check the BasicGL forums before purchasing BasicGL- "arkon" and "ventru" appear to have gone walkies.

www.ag-tools.com/forum/index.php


EDIT:
arkon (Posted 2005-03-02 04:03:26)
Sorry everybody.
I can't actively participate in discussions and support, because I have some big troubles with health.

In the near future I will continue to work on my projects.

Please post all your questions about licensing and BasicGL engine to Modenov Ivan aka MOD at mod@...


Captain Wicker (crazy hillbilly)(Posted 2012) [#219]
Does this support soft body physics and cloth?
thx


Yasha(Posted 2012) [#220]
No.

Last edited 2012


Rroff(Posted 2012) [#221]
Might want to look at blitzbullet thread a litte further down for soft bodies, etc. - tho no idea how well they will be supporting the lib ongoing but seems fairly solid out the box.