M3 L33t HaX0r!
OK...I managed to add
ODE SET BODY POSITION to the ODE plugin. The code is already in there...
void ODE_SetBodyPosition ( int iID, float fX, float fY, float fZ )
{
sODEBody* pBody = ODE_FindBodyID ( iID );
if ( !pBody )
return;
dBodySetPosition ( pBody->dBodyID, fX, fY, fZ );
}
I'm not a C++ coder, but I get the idea. So, I used ResHacker to add the command to the String Table...
77, "ODE SET BODY POSITION%LFFF%?ODE_SetBodyPosition@@YAXHMMM@Z"
I've attached this version to this entry. It still runs(!) and doesn't crash. I then used the command, and it still ran! But...it did nothing whatsoever. You can run the code below using my version of the DLL. There is a Red block, bottom row, near the middle. It's brighter than the rest. I moved it closer to the camera, up and to the right using my new command...nothing.
Thinking it may be that it's moved in ODE but not DB Pro, I ran the code and watched carefully. It actually interacts perfectly, suggesting that it hasn't moved anywhere in ODE either, otherwise it would act strangely.
rem Init DBPro
sync on : sync rate 60 : autocam off
position camera 0,200,-500
point camera 0,100,0
randomize timer()
create bitmap 1,30,30
ink rgb(255,0,0), rgb(0,0,0)
box 1,1,30,15
ink rgb(0,255,0), rgb(0,0,0)
box 1,16,30,30
get image 1,1,1,30,30,1
delete bitmap 1
make light 1
position light 1, 200, 400, -100
point light 1, 0,125,0
rem Init ODE
ode start : ode set world gravity 0,-20,0 : ode set world step 0.05
ode set world erp (0.2)*2.5 : ode set world cfm (10^-5)*2.5
rem Make a floor with sides
make object box 1,800,10,500
position object 1,0,-5,0
ode create static box 1
ode set contact fdir1 1, 10
make object box 2,800,20,10
position object 2,0,0,-250
ode create static box 2
make object box 3,800,200,10
position object 3,0,0,250
ode create static box 3
make object box 4,10,100,500
position object 4,400,0,0
ode create static box 4
make object box 5,10,100,500
position object 5,-400,0,0
ode create static box 5
for n = 2 to 5: Color object n, rgb(128,0,128): next n
rem Make physics based cubes and stack 'em
offset = 12.5
for n = 1 to 5
offset = offset * -1
for m = 1 to 10
cube = 100 + m + ((n-1) * 10)
make object cube cube,50
color object cube, rgb (rnd(128) + 128,rnd(128) + 128,rnd(128) + 128)
position object cube,(-300) + ((m-1) * 65) + offset,25 + (n-1) * 50.2, rnd(10) / 10.0
ode create dynamic box cube
ode set contact fdir1 cube, 10
` If bottom row, make static...
`if n = 1 then ode set response cube, 1: ode set gravity cube, 0
` Make bouncy...
`ODE SETSURFACE MODE cube, 1, 1
`ODE SET CONTACT cube,1,-10000
`ODE SETSURFACE MODE CONTACT BOUNCE cube, 10
`ode set contact bounce cube, 0.5
ODE SET BODY MASS cube, 15
next m
next n
color object 105, rgb(255,0,0)
set object emissive 105,rgb(255,0,0)
ode set body position 105, 50, 300, -10
rem Make a physics based sphere
make object sphere 200,100,6,10
texture object 200,1
position object 200, 0,50,-225
ode create dynamic sphere 200
ode set contact fdir1 200, 1
ode set body mass 200,1000
time = timer()
while timer() < time + 2000
sync
endwhile
ode add force 200, -40 + rnd(80),100,60,0,30,0
`ode set linear velocity 200, rnd(100) - 50, 80, 200
`ode set angular velocity 200,10,0,0
do
ode update
sync
loop
[EDIT]
The function
dBodySetPosition ( pBody->dBodyID, fX, fY, fZ ); is used wherever a new body is created, so I don't understand the problem
It's quite possible that the code cannot find the ODE body, and returns without doing anything, and no error occurs. But that doesn't make sense, I know the body is created, and I could push it around to prove it.