Detecting collisions in .x format levels

Blitz3D Forums/Blitz3D Beginners Area/Detecting collisions in .x format levels

gimpy1(Posted 2005) [#1]
Hi Everyone,
's me ag'in.
I'm using Cartography Shop 4.1 to create game levels.
They are exported as .x files.
Can someone tell me exactly what is in an x file and how to create collisions with the various items in it such as walls, obstacles, ramps, etc.?
Is there some kind of documentation that I can read on this? Most the help files and tutorials I've found so far sort of go in their own direction asuming the reader knows much more plain basic info than I obviously do.
I'm able to use the camera and do a 'walkaround' in my newly created scenes, but, of course I don't run 'into' anything yet.
If the .x format is not the best one to use could you tell me which would be better.....B3D, or CSM?? If one of these is better, could you tell me how to detect collisions in a level of that format?
I'll quit rambling and post this.
Probably millions of additional questions to follow once this one is tucked away safe and warm.
I am pretty excited about learning in this new environment so any help offered is greatly appreciated.
Thanks in advance.
Gimpy


WolRon(Posted 2005) [#2]
I assume you want to set collisions (using the Collisions command) with your game level using method 2 collisions (ellipsoid-to-polygon).


gimpy1(Posted 2005) [#3]
Maybe I got too complicated with my question that sort of grew on me.

I have an .x format scene created in Cartography Shop. It is a floor, four walls, a cube, a cone, and a cylinder (primatives created inside the scene at the same time inCShop so they would be just obstacles and nothing seperately created).

I can display the room in B3D and walk around in it, but I just walk thru everything. There is no indication of a collision that I can find.

PLEASE HELP?? Stumped in Seattkle.
Here's the code I'm using if that will help.

Any assistance is greatly appreciated.

Graphics3D 800,600
SetBuffer BackBuffer()

Global camera_col = 1
Global scenery_col = 2

camera=CreateCamera()
CameraRange camera,1,10000
TurnEntity camera,0,35,0
MoveEntity camera,0,5,-1500
EntityRadius camera,1.5
EntityType camera,camera_col

map=LoadMesh("testroom.x")
lightmap=LoadMesh("testroom_lm.x")
EntityFX map,1
EntityFX lightmap,1
EntityBlend lightmap,2
EntityParent lightmap,map
EntityType map,scenery_col

; Initialise collisions
Collisions camera_col,scenery_col,2,1



While Not KeyHit(1)
If KeyDown( 200 )=True Then MoveEntity camera,0,0,10
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-10
If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0

RenderWorld

If EntityCollided(camera,scenery_col)
Text 30,40,"Collided !!!"
EndIf

Text 30,30,"Collision Detection"


Flip
Wend
End


Xception(Posted 2005) [#4]
First you should export your level as b3d since this is the best format for Blitz3D and CS can export to it.
Then you have to use the collisions command inside your loop and use updateworld command before renderworld command


gimpy1(Posted 2005) [#5]
Thanks Aception,
That worked perfectly.
Many thanks.
Gimpy