Quote: "did u even look at the code u told me to send ?????"
Yes, I replied immediately. I looked up the email I sent. It went out Friday, September 17, 2004 7:32 PM
Here's what was said:
---
Try this file.
You had a few problems.
Namely, you cannot do collision for a camera, which you already know as I
can see from your code. However, you must position the camera object BEFORE
calling RunCollisionPRO() so the system sees the difference in movement.
Then, when the plugin updates the collision camera object, you must fix your
actual camera to lock back to the new position of the camera object.
Also, you were hardlocking position data in variable x/y/z. Once the above
was fixed it would results in sudden "warping" when passing by a collision
because the x/y/z vars got too far away from the object. It's important that
you update these values with the new object positions after calling
RunCollisionPRO().
Warm Regards,
Matthew
NuclearGlory Enterprises
http://www.nuclearglory.com
----
The attached file was sub.dba and it's contents are:
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=3
#Constant RESP_SLIDE_NO_GRAV=4
#Constant RESP_NONE=5
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_LOCK=3
#Constant DYN_RESP_LOCK_NOTURN=4
rem Initialisation
sync on
sync rate 30
hide mouse
autocam off
set camera range 1,70000
StartCollisionPRO(737452718,148672131,581655328)
StartCollisionDebugPRO()
#Constant TYPE_CAM = 10
#Constant TYPE_WORLD = 11
#Constant TYPE_PLAYER = 12
#Constant TYPE_ENEMY = 13
SetCollisionsPro( TYPE_PLAYER, TYPE_WORLD, ELLIP_2_POLY, RESP_SLIDE_NO_GRAV, DYN_RESP_LOCK )
SetCollisionsPro( TYPE_PLAYER, TYPE_ENEMY, ELLIP_2_ELLIP, RESP_SLIDE, DYN_NO_RESP )
SetCollisionsPro( TYPE_PLAYER, TYPE_FREE_CAM, ELLIP_2_ELLIP, RESP_SLIDE, DYN_NO_RESP )
SetCollisionsPro( TYPE_CAM, TYPE_WORLD, ELLIP_2_POLY, RESP_SLIDE, DYN_NO_RESP )
rem We need to set the concave mode a little higher to reduce jittering
rem in tight geometry (default is 3, so let's use 5)
SetConcaveModePRO( 5 )
global cockpit=11
global cockpit=12
global cockpit=13
global sub=14
cockpit1=11
make object box 11,100,3,20
position object 11,0,-10,20
lock object on 11
set reflection shading on 11
cockpit2=12
make object box 12,2,50,2
position object 12,7,15,10
xrotate object 12,330
lock object on 12
set reflection shading on 12
cockpit3=13
make object box 13,2,50,2
position object 13,-7,15,10
xrotate object 13,330
lock object on 13
set reflection shading on 13
load image "station2.bmp",2
texture object 11,2
texture object 12,2
texture object 13,2
`sub 1
sub=14
load object "phantom.x",sub
lock object on 14
position object 14,0,-10,200
scale object 14,1000,1000,1000
ghost object on 14
CollisionTypePRO( sub, TYPE_PLAYER )
SetObjRadiusPRO( sub, 7, 20, 7 )
CollisionTypePRO( cockpit1, TYPE_enemy )
SetObjRadiusPRO( cockpit1, 7, 20, 7 )
CollisionTypePRO( cockpit2, TYPE_enemy )
SetObjRadiusPRO( cockpit2, 7, 20, 7 )
CollisionTypePRO( cockpit3, TYPE_enemy )
SetObjRadiusPRO( cockpit3, 7, 20, 7 )
`cam_obj
global camera=0, cam_obj=16
make object sphere cam_obj,5
lock object on cam_obj
CollisionTypePRO( cam_obj, TYPE_CAM )
SetObjRadiusPRO( cam_obj, 6, 9, 6 )
rem Make a terrain to swim over
seaf = 1
make matrix seaf,70000,70000,10,10
load image "dirtandgrass.jpg",1
prepare matrix texture seaf,1,1,1
fill matrix seaf,7,1
randomize matrix seaf,1000
seat = 2
make matrix seat,70000,70000,10,10
load image "wave code\water.bmp",3
prepare matrix texture seat,3,1,1
fill matrix seat,7,1
position matrix seat,matrix position x(seaf),matrix position y(seaf)+10000,matrix position z(seaf)
level=17
make object cube level,10000
CollisionTypePRO( level, TYPE_WORLD )
rem Set up initial positions and angles
x#=5000
y#=200
z#=5000
theta#=0
phi#=0
gamma#=0
thruststep#=1.0
rem Set up bullets
dim shot#(10,10)
for i=0 to 9
make object sphere i+1,5
next i
do
update matrix seaf
update matrix seat
rem Mouseclicks control speed
if mouseclick()=1 then thrust#=thrust#+thruststep#
if mouseclick()=2 then thrust#=thrust#-thruststep#
rem Now the joystick button controls speed
`if joystick fire a()=1 then thrust#=thrust#+thruststep#
rem Keyboard controls speed
if keystate(16)=1 then thrust#=thrust#-thruststep#
if keystate(17)=1 then yaxisstrafe#=yaxisstrafe#-thruststep#
if keystate(18)=1 then thrust#=thrust#+thruststep#
if keystate(30)=1 then xaxisstrafe#=xaxisstrafe#-thruststep#
if keystate(31)=1 then yaxisstrafe#=yaxisstrafe#+thruststep#
if keystate(32)=1 then xaxisstrafe#=xaxisstrafe#+thruststep#
rem Shooting
rem Putting in a firing delay
if spacekey()=1 and shotrecently#=0
shotrecently#=4
for i=0 to 9
rem If the bullet is 'dead' then create a new one
if shot#(i,0)=0
rem Alive
shot#(i,0)=1
rem Current position
shot#(i,1)=x#
shot#(i,2)=y#
shot#(i,3)=z#
rem Current velocities plus velocities provided by the gun
shot#(i,4)=xvel#+(sin(theta#)*cos(phi#)*20)
shot#(i,5)=yvel#-(sin(phi#)*20)
shot#(i,6)=zvel#+(cos(theta#)*cos(phi#)*20)
rem Angle
shot#(i,7)=theta#
shot#(i,8)=phi#
rem Life
shot#(i,9)=30
show object i+1
exit
endif
next i
endif
if shotrecently#>0 then shotrecently#=shotrecently#-1
rem Update the bullets
for i=0 to 9
rem If the bullet is 'alive' then move it by it's velocity
if shot#(i,0)=1
shot#(i,1)=shot#(i,1)+shot#(i,4)
shot#(i,2)=shot#(i,2)+shot#(i,5)
shot#(i,3)=shot#(i,3)+shot#(i,6)
position object i+1,shot#(i,1),shot#(i,2),shot#(i,3)
shot#(i,9)=shot#(i,9)-1
rem If it's just run out of 'life' then 'kill' it and make
rem it available for use again
if shot#(i,9)=0
hide object i+1
shot#(i,0)=0
endif
endif
next i
rem Mouse movements control angles
theta#=curveangle(theta#+mousemovex(),theta#,7)
phi#=curveangle(phi#+mousemovey(),phi#,7)
remstart
if mousex()>=640 then position mouse 640,mousey()
if mousex()<=0 then position mouse 0,mousey()
if mousey()>=480 then position mouse mousex(),480
if mousey()<=0 then position mouse mousex(),0
if mousex()>=340 then theta#=wrapvalue(theta#+((mousex()-340)*0.015))
if mousex()<=300 then theta#=wrapvalue(theta#+((mousex()-300)*0.015))
if mousey()>=260 then phi#=wrapvalue(phi#-((mousey()-260)*0.015))
if mousey()<=220 then phi#=wrapvalue(phi#-((mousey()-220)*0.015))
remend
rem Keyboard controls angles
if upkey()=1 then phivel#=curvevalue(-5,phivel#,20)
if downkey()=1 then phivel#=curvevalue(5,phivel#,20)
if leftkey()=1 then thetavel#=curvevalue(-5,thetavel#,20)
if rightkey()=1 then thetavel#=curvevalue(5,thetavel#,20)
if upkey()=0 and downkey()=0 then phivel#=curvevalue(0,phivel#,10)
if leftkey()=0 and rightkey()=0 then thetavel#=curvevalue(0,thetavel#,10)
theta#=wrapvalue(theta#+thetavel#)
phi#=wrapvalue(phi#+phivel#)
`oldtheta#=theta#
`oldphi#=phi#
`theta#=wrapvalue(theta#+mousemovex())
`phi#=wrapvalue(phi#+mousemovey())
rem Joystick controls angles
`theta#=wrapvalue(theta#+(joystick x()*0.005))
`phi#=wrapvalue(phi#-(joystick y()*0.005))
if phi#>90 and phi#<180 then phi#=90
if phi#<270 and phi#>180 then phi#=270
rem Decay the thrust so you don't go really fast
thrust#=thrust#*0.9
xaxisstrafe#=xaxisstrafe#*0.9
yaxisstrafe#=yaxisstrafe#*0.9
rem Accelerate the velocities (this took ages to work out)
xvel#=xvel#+(sin(theta#)*cos(phi#)*thrust#)
yvel#=yvel#-(sin(phi#)*thrust#)
zvel#=zvel#+(cos(theta#)*cos(phi#)*thrust#)
xvel#=xvel#+(sin(theta#+90)*xaxisstrafe#)
zvel#=zvel#+(cos(theta#+90)*xaxisstrafe#)
xvel#=xvel#+(sin(theta#)*cos(phi#+90)*yaxisstrafe#)
yvel#=yvel#-(sin(phi#+90)*yaxisstrafe#)
zvel#=zvel#+(cos(theta#)*cos(phi#+90)*yaxisstrafe#)
rem Some friction to stop you going too fast
xvel#=xvel#*0.99
yvel#=yvel#*0.99
zvel#=zvel#*0.99
rem Simple velocity
x#=x#+xvel#
y#=y#+yvel#
z#=z#+zvel#
position camera x#,y#,z#
yrotate camera theta#
xrotate camera phi#
position object cam_obj,camera position x(0),camera position y(0),camera position z(0)
rotate object cam_obj,camera angle x(0),camera angle y(0),camera angle z(0)
RunCollisionPRO()
x# = object position x(cam_obj)
y# = object position y(cam_obj)
z# = object position z(cam_obj)
position camera x#,y#,z#
position object cam_obj,camera position x(0),camera position y(0),camera position z(0)
rem Screen display
text 0,0,"X velocity:"
text 0,20,"Y velocity:"
text 0,40,"Z velocity:"
text 0,60,"Theta:"
text 0,80,"Phi:"
text 0,100,"Thrust:"
`text 100,0,str$(xvel#)
`text 100,20,str$(yvel#)
`text 100,40,str$(zvel#)
text 100,0,str$(x#)
text 100,20,str$(y#)
text 100,40,str$(z#)
text 100,60,str$(theta#)
text 100,80,str$(phi#)
text 100,100,str$(thrust#)
rem Rotate and position the camera
update matrix 1
update matrix 2
sync
loop
Let me know if you need any more help.