colision setup

Blitz3D Forums/Blitz3D Beginners Area/colision setup

Agamer(Posted 2003) [#1]
ok i have started working with some colisions and bits but id dosen't work it saying not anoth peramters on the colision but i only want to detect the clolisons of the teo items


Ross C(Posted 2003) [#2]
well, you first give each entity an entity type
player=CreateSphere()
EntityType player,1

target=CreateCone()
EntityType target,2


this creates a sphere and a cone and gives them different entittype number, which is needed for them to detect collisions. Now we use the collisions command, which sets up collision between the two entity's. We use the entity type numbers here to refer to the entity you want to be invovled with the collision.

Collisions 1,2,2,2


the first two parameters are the two entitytypes you want the set up the collisions. The next parameter is how you would like to check the collision.

method - collision detection method.
1: sphere-to-sphere collisions
2: sphere-to-polygon collisions
3: sphere-to-box collisions

the last parameter is the response you want

1: stop
2: slide1 - full sliding collision
3: slide2 - prevent entities from sliding down slopes

so i set up the collision between entitytype 1 and 2 using Sphere to polygon detection, with a response of slide 1.

hope that helps


Agamer(Posted 2003) [#3]
thanks


and i meant to pst the code so here it is any way

Graphics3D 1024,768
SetBuffer BackBuffer()

camera=CreateCamera()
EntityType camera,3
CameraRange camera,0.1,100

light=CreateLight()
TurnEntity light,45,30,0

;inside setup
inside=LoadMesh( "test.b3d" )
PositionEntity inside,0,25,0
EntityType inside,1

;player setup
player=CreateCone()
PositionEntity player,0,0,-7
EntityType player,2

;colision
Collisions 1,2

While Not KeyHit(1)


If KeyDown(200) Then MoveEntity player,0,0,0.1
If KeyDown(208) Then MoveEntity player,0,0,-0.1
If KeyDown(203) Then TurnEntity player,0,1,0
If KeyDown(205) Then TurnEntity player,0,-1,0


UpdateWorld
RenderWorld
Flip
Wend
End



Ross C(Posted 2003) [#4]
yeah, your missing your detection and reaction parameters for the collisions command.

Graphics3D 1024,768
SetBuffer BackBuffer()

camera=CreateCamera()
EntityType camera,3
CameraRange camera,0.1,100

light=CreateLight()
TurnEntity light,45,30,0

;inside setup
inside=LoadMesh( "test.b3d" )
PositionEntity inside,0,25,0
EntityType inside,1

;player setup
player=CreateCone()
PositionEntity player,0,0,-7
EntityType player,2

;colision
Collisions 1,2,2,2

While Not KeyHit(1)


If KeyDown(200) Then MoveEntity player,0,0,0.1
If KeyDown(208) Then MoveEntity player,0,0,-0.1
If KeyDown(203) Then TurnEntity player,0,1,0
If KeyDown(205) Then TurnEntity player,0,-1,0


UpdateWorld
RenderWorld
Flip
Wend
End


there, fixed!


Agamer(Posted 2003) [#5]
thanks but for some reson all i'm getting a black screen


Agamer(Posted 2003) [#6]
ok i got the cone to apear on the screen but o can't b3d file to appear


Ross C(Posted 2003) [#7]
try downscaling the .b3d file, it might be too big to see. either that or move the camera out more.