Ship going through dock

Blitz3D Forums/Blitz3D Programming/Ship going through dock

asdfasdf(Posted 2004) [#1]
The ship goes throught the dock. What is wrong?
AppTitle "Great Lakes Shipping"

SetBuffer BackBuffer()

Graphics3D 1280,1024,32,0

light = CreateLight()

Dim Cam(5)

Cam(0) = 0.0
Cam(1) = 30.0
Cam(2) = -50.0
Cam(3) = 1
Cam(5) = CreatePivot()

PositionEntity Cam(5),Cam(0),Cam(1),Cam(2)

Global BoatX = 0
Global BoatY = 10
Global BoatZ = 0
Global BoatYaw = 180

Global Water = CreatePlane()

EntityType Water,1

EntityColor Water,0,0,255

Global Oreboat = LoadMesh("Data\Boats\Ore Carrier\Oreboat.3ds")

;Collisions
;1 = Water
;2 = Oreboat
;3 = Oredock

Collisions 2,1,3,3

EntityType Oreboat,2

Global camera = CreateCamera(Cam(5))

PositionEntity Camera,Cam(0),Cam(1),Cam(2)

RotateEntity Oreboat,270,180,90

Oredock = LoadMesh("Data\Graphics\Oredock.3ds")

EntityType Oredock,3

RotateEntity Oredock,270,90,0

PositionEntity Oredock,0,40,100

Collisions 2,3,1,1

While Not KeyHit(1)

TestKeys()

RenderWorld
UpdateWorld
Flip
Wend

FreeEntity Oredock
ClearMem()

Function ClearMem()

FreeEntity Oreboat
FreeEntity Water
FreeEntity Camera
FreeEntity Light

End

End Function

Function TestKeys()

If KeyHit(2) Then
	Cam(3) = 1
ElseIf KeyHit(3) Then
	Cam(3) = 2
EndIf

If KeyDown( 203 ) And Cam(4) = 2 Then
	RotateEntity Cam(5),0,0.1,0
EndIf

If KeyDown( 203 ) And Cam(3) = 1
	BoatX = BoatX + -1.0
	Cam(0) = Cam(0) + -1.0
	Update = True
EndIf

If KeyDown( 205 ) And Cam(3) = 1
	BoatX = BoatX + 1.0
	Cam(0) = Cam(0) + 1.0
	Update = True
EndIf

If KeyDown( 208 ) And Cam(3) = 1
	BoatZ = BoatZ + -1.0
	Cam(2) = Cam(2) + -1.0
	Update = True
EndIf

If KeyDown( 200 ) And Cam(3) = 1
	BoatZ = BoatZ + 1.0
	Cam(2) = Cam(2) + 1.0
	Update = True
EndIf

If KeyDown( 75 )
	BoatYaw = BoatYaw + 1.0
	Update = True
EndIf

If KeyDown( 77 )
	BoatYaw = BoatYaw + -1.0
	Update = True
EndIf

If Update = True Then
	PositionEntity Oreboat,BoatX,BoatY,BoatZ
	RotateEntity Oreboat,270,BoatYaw,90
	Update = False
	PositionEntity Cam(5),Cam(0),Cam(1),Cam(2)
EndIf

End Function



jhocking(Posted 2004) [#2]
Um, is this a trick question? You tell us what's wrong.


xmlspy(Posted 2004) [#3]
Do not utilize PositionEntity, RotateEntity. Use Moveentity, and TurnEntity.

Positioning makes the collisions not work at all, check the b3d docs on Moveentity and TurnEntity. Also, what the hell are you trying to accomplish? we can't see what you see because we don't have your 3d models.


Gabriel(Posted 2004) [#4]
Do not utilize PositionEntity, RotateEntity. Use Moveentity, and TurnEntity.

Positioning makes the collisions not work at all, check the b3d docs on Moveentity and TurnEntity.


I'm pretty sure that's not true. I've never used MoveEntity or TurnEntity and I've never had any Blitz collision problems. Granted, Blitz collisions are a wee bit crap, and I tend to use alternatives in anything serious, but I'm still pretty sure that's not the case.

From a quick glance, I can't see any reference to EntityBox or EntityRadius, and that could be the problem. Blitz can't guess how large the collision sphere and box should be, you'll have to tell it.


xmlspy(Posted 2004) [#5]
I have used PositionEntity and the meshes go straight through other models. I might have not set up the radius correctly. I enjoy utilizing move and turn entity more than positioning and rotate, so that’s what came to mind. Sorry, :)


Tracer(Posted 2004) [#6]
trust me, PositionEntity works JUST fine with collisions.. to the extend that positioning an entity in a level with collisions makes it COLLIDE on the way! (yeah, PositionEntity actually MOVES the entity, it doesn't POSITION it..)

Tracer


Sweenie(Posted 2004) [#7]
Um, is there any difference between move/turn & position/rotate except that move/turn applies a relative transform to the entity while position/rotate applies a fixed transform?


asdfasdf(Posted 2004) [#8]
The "oreboat.3ds" is a ship. The water collision works fine.


_PJ_(Posted 2004) [#9]
Try UpdateWorld before Renderworld. (Dunno just personal preference)

AFAIK PoitionEntity will still allow collisions.

I would guess it's the collision radii - especially if your meshes are large-ish.


WolRon(Posted 2004) [#10]
Why call it Cam(0), Cam(1), etc. How confusing. It's just as easy to call it CamX, CamY, etc. Now you don't even have to remember which is which.

This has got to be one of the strangest ways I have ever seen on ending a program:
FreeEntity Oredock
ClearMem()

Function ClearMem()

FreeEntity Oreboat
FreeEntity Water
FreeEntity Camera
FreeEntity Light

End

End Function


Also, How do you know that your water collision works? You never send the boat downward (Y movement).


wizzlefish(Posted 2004) [#11]
maybe use cube placeholders so we can actually test it?


asdfasdf(Posted 2004) [#12]
You can click
here to get the file. The main file is called Great Lakes Shipping. Does anybody know how to get the physics working. Like the ship slowly decrease it's speed when you stop. I'm trying to make it like Train Simulator if anybody has it.

Edit: Go here and then click Dowload GLS