Using a dropship

Blitz3D Forums/Blitz3D Programming/Using a dropship

I need some help,
I want a player to be able to walk in to a dropship and the dropship be able to take off and rotate with player still able to walk and jump around inside.


I have try Parenting the player to the ship on Collision but if the ship moves up the player still falls down through the ship because of is Gravity.

Create a pivot and position it at 0,0,0.

Move the drop ship.

Move the pivot the same amount as the drop ship, So the pivot does the same as the drop ship exactly.

Translate you player entityx,y,z of the pivot.

Do you usual player movement.

If you PARENT the player to the ship, then it should impossible for them to fall through it.

Are you sure you are doing it correctly.
What Rob Farley wrote shouldn't be necessary.

Yes it is parented correctly, but like I said I want the player to able to move and jump inside so I need to have gravity on the player. On flat surfaces in the dropship it works for X, Z moving of the dropship but on slopping surfaces the player is falling through even when the ship is only moving X, Z. The player always falls through when the ship is moving UP.

Can't you just move the scenery instead and leave the ship stationary? Same difference to the player, massively easier to cope with for you and your collision.

No, it is going to be multiplayer and other AIs are in it to.

What you've got is 2 moving bodies you are checking for collision. Blitz can't handle this 'out of the box' so you need to do it yourself. Simplest way to do this is a fudge-

update player position, collision detection stops him moving thru ship (call players new position *A*)
updateworld()
(now to move the ship........)
move player in opposite direction to required ship movement. Blitz collisions will stop him falling through.
updateworld()
measure vector V moved by player and reset his position
to *A*
move ship in direction -V

main Updateworld()

I've probably made a pigs ear of explaining this, but you can probably find code examples if you look around. Basic idea is you are recreating the same relative movements of the 2 bodies you want to check for collision, but always moving the object that has sphere collision.

.....or use a 3rd party collision engine.........

Does this help get you going? The shortcuts for the purposes of demonstration are commented, you should be able to see the main cost (multiple updateworld's) immediately...

Slide-response Blitz collision against a rising mesh on an increasing angle.
Graphics3D 640,480,0,3
SetBuffer BackBuffer()



level=CreateCube()
cam=CreateCamera()
PositionEntity cam,0,5,-5;10
light=CreateLight()
PositionEntity light,10,10,0

player=CreateCube()
ScaleEntity player,.1,.1,.1
EntityRadius player,.1
PositionEntity player,1,10,0


EntityType player,1
EntityType level,2
Collisions 1,2,2,2

While Not KeyDown(1)

;apply gravity to the player
TranslateEntity player,0,-.1,0

;update the world
UpdateWorld


;did player collide with level
;if so then make player child of level
If CountCollisions(player)>0; you would normally check which entity but we KNOW it's the level here
	RotateEntity player,EntityPitch(level,True),EntityYaw(level,True),EntityRoll(level,True),True;should get level normals instead and apply appropriately
	EntityParent player,level 	
EndIf

;move level
TranslateEntity level,.005,0.005,0
If EntityRoll(level)<5 Then TurnEntity level,0,0,.02

;free player from parent
EntityParent player,0

;updateworld
UpdateWorld
;render
RenderWorld



Flip True
Wend



why don't you just use linepick straight down from the players feet? you can get real world coords for that pick and then stop applying gravity when the distance between the 2 fall below a certain point.

this link might help you out.
http://www.blitzbasic.com/Community/posts.php?topic=38752

i had a problem like this with moving platforms rising up: i just a collission box check to see if the char was within the areas to collide, and removed gravity if it reterned true, while simultaneously moving the char the same as the platform:i used this to check the box collission area:
Function entCubeLaps(entity1,rad#,ax#,ay#,az#,havwidth#,havlen#=0,havheight#=0);checks sphere for intersection with cube
	
	If Not havlen havlen=havwidth
	If Not havheight havheight=havwidth
	

	Local piv%=CreatePivot():PositionEntity piv,EntityX(entity1),EntityY(entity1),EntityZ(entity1)
	;point it towrads 'box', and move it towards it by the suggested Radius
	entity2=CreatePivot():PositionEntity entity2,ax,ay,az
	PointEntity piv,entity2:MoveEntity piv,0,0,rad#:FreeEntity entity2
	
	Local bx#=EntityX(piv),by#=EntityY(piv),bz#=EntityZ(piv)
	
	FreeEntity piv
	
	;final condition
	If (bx>=ax-havwidth# And bx=<ax+havwidth#) And (by>=ay-havheight# And by<=ay+havheight#) And (bz>=az-havlen# And bz<=az+havlen#) Return True
	
	
	Return False
End Function


"Sledge" I got your code to work but like you said you need 2 updateworlds a loop but I don't loss too much speed, if you can do it with one I would like to see it (I think I’m being too hopeful)

dmaz and aab the ship also turned and moved in any direction and it was not just the player's gravity that was the problem, the ship was moving forward and the player went though the ship sideways when on sloped surfaces.

Thanks for all the help.