Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / ode physics question

Author
Message
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 15th Apr 2006 06:40
hello people.i changed to ode now. i understand it much better than newton...it was a lot easier to learn.but anyhow,i do need to know one thing. in my game,i dont use objects to represent bullets,i use ray casts. i am planning on using sparky's collision dll to ray cast,and if the ray hit anything add a force to it. but adding the force is what i dont know how to do. so any help on adding forces would be helpful. thanks in advance.

all ben needs is his band,his guitar,and his computer...
and his dead little power puff girls...
Tachyon
18
Years of Service
User Offline
Joined: 15th Sep 2005
Location: four-momentum imaginary proper time
Posted: 15th Apr 2006 11:53 Edited at: 15th Apr 2006 11:58

Ode keywords.ini file
You can use ode add force relative, it's much more predictable than ode add force.
For example, in my open source ode bowling game i use it like
ODE ADD FORCE RELATIVE "object","force direction x", "force direction y","force direction z",0,0,0
Same applies to Ode add force.

I included the game mainloops source code so you can examine it to find the better example


Note: it needs newest ODE that Ian M posted in the DLL talk
Note 2: Im from finland so sorry for comments and variable names

EDIT: Before Batvink or any other gets to say it there is a tutorial on the older newsletter:
http://www.thegamecreators.com/data/newsletter/newsletter_issue_34.html#8

(2b)||C!(2b) (It's C++) vs. TO B OR NOT 2B (It's DarkBasic!)
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 15th Apr 2006 16:43
alrighty.i see that,but then how do you add a force so it will move according to the direction the bullet came from?

all ben needs is his band,his guitar,and his computer...
and his dead little power puff girls...
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Apr 2006 16:46
Try:

ODE ADD FORCE enemy, player x, player y, player z, enemy x, enemy y, enemy z


That might make it go a bit far, but meh...

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 16th Apr 2006 00:01
all is clear now. i just messed around with ode add force relative,and viola! it worked. of course,the command itself wasnt getting highlighted so i thought it wasnt working.thanks people.

all ben needs is his band,his guitar,and his computer...
and his dead little power puff girls...
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 16th Apr 2006 17:44
why doesnt ODE CREATE DYNAMIC TRIANGLE MESH obj work? i've been trying to use it,but the objects just fall through the level.

all ben needs is his band,his guitar,and his computer...
and his dead little power puff girls...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Apr 2006 20:28
It does work, but only with non-indexed objects IIRC.

Take your object, convert it to a mesh, then a memblock. Then convert it back in the other direction - this will remove all of the indices from the final object.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 16th Apr 2006 22:06
...how do you make a memblock out of a mesh? i've never learned memblocks. any tutorials on them?

all ben needs is his band,his guitar,and his computer...
and his dead little power puff girls...
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 16th Apr 2006 22:41 Edited at: 16th Apr 2006 22:43
MAKE MEMBLOCK FROM MESH
This command will make a memblock from a mesh. The specified values must be integer values and the source resource
must exist or the command will fail. The mesh memblock is layed out in the following format. The first DWORD is the FVF
Format, which controls which components each vertex of your mesh will contain. The default FVF Format is 338. The
second DWORD is the FVF Size, which is the size in bytes of a single vertex element. This size is respective of the FVF
Format you specified, which has a default of 36. The third DWORD is the number of Vertices in your mesh. The remainder
of the memblock contains mesh data. The mesh data is a sequential list of vertices, containing the component data
arranged as specified by the FVF Format. The default FVF Format would specify the following arrangement of data within
the vertex element, which is duplicated for every vertex specified in the memblock. Each grouping of three vertices
makes a polygon. Given the default FVF Format of 338, the first three FLOAT values (12 bytes) of the vertex element
would be the XYZ coordinates in model space. The second three FLOAT values (12 bytes) of the vertex element would
be the normals coordinates in model space. The next DWORD is a diffuse colour component that specifies the colour of
the vertex. The last two FLOATS are UV texture coordinates for the vertex. This adds up to 36 bytes which is the size of
a single vertex. Multiply 36 by the number of vertices in the mesh and you get the overall size of the mesh data.

SYNTAX
MAKE MEMBLOCK FROM MESH Memblock Number,Mesh Number



straight from the help file on memblocks


for tuts try tutorial city i am pretty sure they had a memblock in there

Ink all over the screen...and dang it! Signature still does not show.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 18th Apr 2006 02:56
so...what you would do is sorta like this:


that was just a basic thing? im guessing you write to the already made memblock in that order or something?

all ben needs is his band,his guitar,and his computer...
and his dead little power puff girls...
Bmad6
18
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 18th Apr 2006 04:18
It sounds to me like all you need to do is:

make memblock from mesh
make mesh from memblock

I'm not sure, but...
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 19th Apr 2006 18:44
4 commands will do it all for you

make mesh from object
make memblock from mesh
make mesh from memblock
make object

look those up and voila...you got your full conversion system

Ink all over the screen...and dang it! Signature still does not show.

Login to post a reply

Server time is: 2024-05-02 09:30:54
Your offset time is: 2024-05-02 09:30:54