Grr! I'm getting really frustrated here! I just can't get my ball physics correct! I've been trying to get it so my ball can ride off the ramp and be able to fly over the bar, but I can't seem to get it to start off rolling slow and then go fast. I tried Omega and that didn't work. Failing that, I tried torque. Now this makes my ball handle REALLY strange, making accleration questionably odd and generally making turning feel very awkward: no wonder the vehicle demo was so unplayable! :/
On top of that, it seems that the reason why my ball would move diagonally when I moved the ball was because it was reaching the maximum allowed X and Z rotating speeds. I then decided to slace down my ball and level models, and shrink the Newton sphere body. However, when I did this, the tree collision acted as though the level hadn't shrunk at all! Why must Newton make my life so hard?! This is ridiculous! Ever since I placed my Newton update command into the FOR loop for constant speed, it has been acting up more than ever!
Incase you need it, here is the code I currently have:
Rem Project: Ballistica
Rem Created: 12/11/2004 12:43:45 PM
Rem ***** Main Source File *****
set window title "Ballistica"
sync on : sync rate 0
set display mode 640,480,32
`Let's make a loading screen here. Also, we will hide the mouse.
hide mouse
set text size 12
autocam off
load image "DataLoadTI.png",1
sprite 1,(screen width()-640)/2,(screen height()-480)/2,1
paste sprite 1,(640-screen width())/2,(480-screen height())/2
backdrop on
color backdrop 0
sync
sync
set image colorkey 0,128,255
sync
nupdate=0.1
nspeed=40000
ngravity=-4000
load object "DataSkybox1.x",10
set object ambient 10,0
set object ambience 10,rgb(255,255,255)
set object specular 10,rgb(255,255,255)
set object emissive 10,rgb(255,255,255)
set object diffuse 10,rgb(255,255,255)
set object specular power 10,255
set object texture 10,2,0
scale object 10,1900,1900,1900
rotate object 10,0,90,0
fix object pivot 10
csm initial object 1000
csm initial image 1000
csm blend mode 5
nErr = load csm("DataCourse1.csm",2)
if nErr <>1 then exit
set object transparency 1000,0
set point light 0,5000,5000,1000
color light 0,255,255,255
show light 0
set light range 0, 1000000
set ambient light 20
make object sphere 1,8,64,64
make object sphere 2,7.8,12,12
ghost object on 2
fade object 2,0
set shadow shading on 2
scale object 1000,.25,.25,.25
NDB_NewtonCreate
NDB_NewtonSetMinimumFramerate 200
NDB_SetVector 0,ngravity,0
NDB_SetStandardGravity
BallCol=NDB_NewtonCreateSphere (4,4,4)
Ball=NDB_NewtonCreateBody(BallCol)
NDB_BuildMatrix 0,0,0,0,10,0
NDB_NewtonBodySetMatrix Ball
NDB_CalculateMISphereSolid 1,32
NDB_NewtonBodySetMassMatrix Ball,1,5,5,5
NDB_NewtonBodySetAutoFreeze Ball,0
NDB_NewtonReleaseCollision BallCol
NDB_BodySetDBProData Ball,1
NDB_BodySetGravity Ball,1
LvLCol = NDB_NewtonCreateTreeCollision(1000)
Level = NDB_NewtonCreateBody(LvLCol)
position object 1,0,-96,0
position object 2,0,-96,0
camroty=90
camrotx=60
set camera fov 100
set camera range 10,9000
set normalization on
position camera 0,256,0
rdelay#=1
rdn#=0
ndbtime#=NDB_GetElapsedTimeInSec()
ndbtime#=NDB_GetElapsedTimeInSec()
`cls
`center text (screen width()/2),(screen height()/2),"Loading Music..."
`sync
load music "DataSong-Rediscover.wma",1
loop music 1
do
if obj <> 0
delete object obj
endif
delta# = (timer() - start#)*0.4
start# = timer()
if delta#>50 then delta#=50
dsmooth# = dsmooth#+(delta#-dsmooth#)/1.5
if dsmooth#>50 then dsmooth#=50
ndbtime#=NDB_GetElapsedTimeInSec()
for t=0 to dsmooth# step 1
inc i,10 : if i>80 then i=10
set camera fov 100+(mousez()/120)
if shiftkey()=1
text 10,(screen height() -20),"Framerate: "+str$(screen fps())
text 10,(screen height() -40),"Deltatime Frame Skip: "+str$(delta#)
text 10,(screen height() -60),"Deltatime Smooth: "+str$(dsmooth#)
text 10,(screen height() -80),"Mousewheel: "+str$(mousez())
text 10,(screen height() -100),"Scene Poly Count: "+str$(statistic(1))
endif
inc camrotx,0-(mousemovey()/2.0)
inc camroty,(mousemovex()/2.0)
camrotsx#=camrotsx#+((camrotx-camrotsx#)/0.001)
camrotsy#=camrotsy#+((camroty-camrotsy#)/0.001)
if camrotx > 89.9997 then camrotx = 89.9997
if camrotx < 1 then camrotx = 1
if camrotsx# > 89.9997 then camrotsx# = 89.9997
if camrotsx# < 1 then camrotsx# = 1
position camera (((cos(0-camroty))*sin(camrotx))*320),(cos(camrotx))*320,(((sin(camroty))*sin(0-camrotx))*320)
position camera (camera position x(0)+object position x(1)),(camera position y(0)+object position y(1)),(camera position z(0)+object position z(1))
`rotate camera wrapvalue(camrotx/3),wrapvalue(camroty/3),0
NDB_NewtonUpdate nupdate
`position camera 0,object position x(1),object position y(1)+192,object position z(1)-320
point camera object position x(1),object position y(1),object position z(1)
position object 10,camera position x(),camera position y(),camera position z()
position mouse (screen width()/2),(screen height()/2)
if keystate(32)=1
bmovex#=cos(0-camroty)*nspeed
bmovez#=sin(0-camroty)*nspeed
endif
if keystate(30)=1
bmovex#=cos(0-camroty-180)*nspeed
bmovez#=sin(0-camroty-180)*nspeed
endif
if keystate(31)=1 and keystate(30)=0 and keystate(32)=0
bmovex#=cos(0-camroty-90)*nspeed
bmovez#=sin(0-camroty-90)*nspeed
endif
if keystate(31)=1 and keystate(30)=1 and keystate(32)=0
bmovex#=cos(0-camroty-135)*nspeed
bmovez#=sin(0-camroty-135)*nspeed
endif
if keystate(31)=1 and keystate(30)=0 and keystate(32)=1
bmovex#=cos(0-camroty-45)*nspeed
bmovez#=sin(0-camroty-45)*nspeed
endif
if keystate(17)=1 and keystate(30)=0 and keystate(32)=0
bmovex#=cos(0-camroty+90)*nspeed
bmovez#=sin(0-camroty+90)*nspeed
endif
if keystate(17)=1 and keystate(30)=1 and keystate(32)=0
bmovex#=cos(0-camroty+135)*nspeed
bmovez#=sin(0-camroty+135)*nspeed
endif
if keystate(17)=1 and keystate(30)=0 and keystate(32)=1
bmovex#=cos(0-camroty+45)*nspeed
bmovez#=sin(0-camroty+45)*nspeed
endif
if keystate(17)=0 and keystate(31)=0 and keystate(30)=0 and keystate(32)=0
bmovex#=0
bmovez#=0
endif
NDB_SetVector bmovex#,bmovey#,bmovez#
NDB_BodyAddTorque Ball
if spacekey()=1
NDB_BuildMatrix 0,0,0,0,10,0
NDB_NewtonBodySetMatrix Ball
endif
next t
updatedisplay()
position object 2,object position x(1),object position y(1),object position z(1),
if sprite visible(1)=1 then hide sprite 1
if controlkey()
obj = NDB_DebugMakeNewtonObject()
else
obj = 0
endif
loop
NDB_NewtonDestroy
end
function updatedisplay()
restore cams
for c=1 to 6
make camera c
read x,y,z
rotate camera (c),x,y,z
position camera (c),object position x(1),object position y(1),object position z(1)
set camera to image (c),20+(c),32,32
set camera range c,10,9000
set camera aspect c,1
set camera fov c,90
next c
sync
for c=1 to 6
delete camera c
next c
set cube mapping on 1,20+1,20+2,20+3,20+4,20+5,20+6
cams:
data 0,90,0
data 0,270,0
data 270,0,0
data 90,0,0
data 0,0,0
data 0,180,0
endfunction
UNVIDIA GeFartFX 5600 Crud Edition
Featuring an unbeatable 0-1 FPS in 3DMark05!
If Return to Proxycon were a game, I would die before I saw the door open!