EDIT: Okay, I think I've got it working now.
Once I realized that the "passenger" will always be in collision with the "ship" (since the the ship's bounding box is MUCH bigger than just the deck) I got a grip on the problem.
Basically,
1. Any part of the ship that needs to be checked for collision needs to be a seperate object
that follows the ship. Thus the railings are not part of the ship model, but move with it.
2. Glue a dummy object to the ship for each passenger.
3. Use the
dummy object to position the passenger. Movement keys move the dummy object, then the passenger is updated.
4. Check the
passenger against the
rails for collision, but move the
dummy object away from the rail, not the passenger.
Thus;
set display mode 800,600,32
` Just for fun, make an ocean,
` a semi-boat-looking thing,
` a sky, and a passenger.
ink rgb(0,0,255),0:box 0,0,32,32:ink rgb(255,255,255),0:line 0,20,16,12:line 16,12,32,20:get image 4,0,0,32,32,3
ink rgb(128,64,0),0:box 0,0,32,32:get image 1,0,0,32,32:ink rgb(255,255,255),0:box 0,0,32,32:get image 2,0,0,32,32
make object box 1,15,5,30:texture object 1,1
make object cylinder 2,1:set object cull 2,0:scale object 2,100,2000,100:texture object 2,1:glue object to limb 2,1,0:position object 2,0,12,3
make object box 3,15,10,0.1:glue object to limb 3,1,0:position object 3,0,16,3.1:texture object 3,2
make object box 4,1,1,30:texture object 4,1
make object box 5,1,1,30:texture object 5,1
make object plane 9,2000,2000:xrotate object 9,90:position object 9,0,-2,0:texture object 9,4:scale object texture 9,1000,1000
` Dummy object to place passenger
make object box 11,2.1,5.1,2.1
glue object to limb 11,1,0
position object 11,0.0,5.0,-5.0
color object 11,0
set object wireframe 11,1
` Passenger
make object box 10,2,5,2
autocam off
position camera 30,15,-30
point camera 0,0,0
color backdrop rgb(150,150,200)
set ambient light 70
nShipSpeed# = 0.01
nShipTurn# = 0.02
set global collision on
do
nSpeed#=0.0
if upkey() then nSpeed#=nShipSpeed#
if downkey() then nSpeed#=nShipSpeed#*-1.0
if leftkey()
yrotate object 1,wrapvalue(object angle y(1)-nShipTurn#)
endif
if rightkey()
yrotate object 1,wrapvalue(object angle y(1)+nShipTurn#)
endif
if keystate(30)
nOldX#=object position x(11)
move object left 11,0.01
if object collision(10,4)
text 0,0,"COLLISION WITH LEFT RAIL"
position object 11,nOldX#,object position y(11),object position z(11)
endif
endif
if keystate(32)
nOldX#=object position x(11)
move object right 11,0.01
if object collision(10,5)
text 0,0,"COLLISION WITH RIGHT RAIL"
position object 11,nOldX#,object position y(11),object position z(11)
endif
endif
if keystate(17)
move object 11,0.01
endif
if keystate(31)
move object 11,-0.01
endif
move object 1,nSpeed#
set object to object orientation 4,1,1
position object 4,object position x(1),object position y(1),object position z(1)
move object up 4,3
move object left 4,7
set object to object orientation 5,1,1
position object 5,object position x(1),object position y(1),object position z(1)
move object up 5,3
move object right 5,7
position object 10,object position x(1),5.0,object position z(1)
yrotate object 10,object angle y(1)
move object 10,object position z(11)
move object left 10,object position x(11)*-1.0
loop
This doesn't do anything for getting the passengers on the ship, but it does let them walk around while the ship is moving.