Alright,these are two things I had been planning for my game for a while. First issue,explosions. When I modify the explosion function in the "Explosion" demo,it doesn't work. Here is the modified code for that:
function createExplosion(x#,y#,z#,force#,size#)
sqrSize# = size#*size#
rem cycle through all objects to receive the force
for i=1 to 20000
if Object exist(i)=1
difx# = (object position x(i)-x#)
dify# = (object position y(i)-y#)
difz# = (object position z(i)-z#)
dist# = difx#*difx# + dify#*dify# + difz#*difz#
if phy get rigid body exist(i)
rem if close enough, apply a force relative to objects distance from the exlposion
if dist#<sqrSize# and phy get rigid body mass(i) > 0.0
dist# = sqrt(dist#)
forcex# = difx#/dist# * force#*1
forcey# = dify#/dist# * force#*1
forcez# = difz#/dist# * force#*1
phy add rigid body force i,forcex#,forcey#,forcez#, 1
endif
endif
endif
next i
endfunction
That code doesn't effect any rigid body.
Now onto issue 2. In my game I wanted implosions as well. Now,how would I go about doing this? Can I have spots of gravity so things can be sucked into that,and then delete the point. Or do I have to apply a force to the object until it goes to that one point? Thanks in advance
Woohoo. DP is finally released!
