Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Collision hollow cube

Author
Message
Sanguis
15
Years of Service
User Offline
Joined: 10th Jan 2011
Location: Deutschland
Posted: 15th Jan 2015 19:31
Hi,

I try a thing that sounds simple.
I made a Cube, hollow it, give it textures an exported it (DeleD 3D) as .x file.

I loaded it in DB, this works very well.
The Camera is inside this cube. I would like the walls to be...walls. So I tried the Automatic Camera Collision. This works...to good. When I move the camera I get throu out of my Cube.
I think I know th reason. Inside the cube the Camera is overlapping the cube and so a collision is triggert.
But...how can I make only the walls trigger a collision? Does I need 4 objects? No hollow Cube?

Here is my Code:



Hope you can help me with that.

Greetings,
Andreas

~ And when I sometimes clos my Eyes, my mind starts, spinning around.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th Jan 2015 07:41
You did not set any collision for the object, so the camera can't collide with anything.
As a hollow cube, you could either:

1- "divide" the object into 4 limbs in your 3d software, so that it is exported as 1 object with 4 limbs, then you will set the collision of the objects to limbs with the command "SET OBJECT COLLISION TO BOXES"

2- set collision to polygons for the object with the command "SET OBJECT COLLISION TO POLYGONS", this is the worst choice for performance but the faster way to get the job done

3- if the object will be an object that doesn't need to move, so for example walls of a building, you could just set some static collisions with the command "make static collision box", this is the best choice for performance, but will takes some time to set it up, you need to know exactly where a wall starts and ends on a 3d space, and how wide it is, as you need to fill the command with 6 different coordinates (x1,y1,z1,x2,y2,z2).
I usually take these values by walking with my character on the edges of each wall, writing on paper the 6 values (in your main loop print or text the character's coordinates to see where it is)
Sanguis
15
Years of Service
User Offline
Joined: 10th Jan 2011
Location: Deutschland
Posted: 16th Jan 2015 13:16
Hi,

thanks for your answer.
Yes, I want the hollow cube to be the inner of a building, in wich I can fly around with the camera.
That's why I thought "AUTOMATIC CAMERA COLLISION 1, 5, 0" would be enough.

For me the best way sounds the thing with limbs. The problem is, it's new for me. When I hollow the Cube in Deled (the 3D program I use), I get the walls as segments. Is this the same? If it is, I need to find out how I can use them by having still one .x file.

I will try around a little bit, hope to get it out.

Greetings,
Andreas

~ And when I sometimes clos my Eyes, my mind starts, spinning around.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th Jan 2015 19:17 Edited at: 16th Jan 2015 19:21
I do use 3ds max for 3d modelling, to do that with max, you need to have the 4 walls as separate objects, then when you export it, each object will be seen as a limb in darkbasic pro (exporting in .x with the panda exporter plugin).
In 3ds max to "divide" the object into 4 different limbs, you could add an Editable Poly modifier, then select the polygons of 1 side and click detach, and do the same with the other 3 walls

Edit: Remember also that you need to click export and not export selected otherwise you will export just 1 of the limbs as a single object (unless you select all of them)
Sanguis
15
Years of Service
User Offline
Joined: 10th Jan 2011
Location: Deutschland
Posted: 16th Jan 2015 20:37
I think that's the same in Deled. There I have a cube, click on "hollow", can input the thickness of every wall and get it. I think it works. I simply tried to color a limb, to test around. This works. So i can convert every limb to an object.

I tryed to work with this for collision but still had problems. Then I found a great function here in this forums:



That works great and does what I need.

~ And when I sometimes clos my Eyes, my mind starts, spinning around.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 16th Jan 2015 20:37
Why not just create planes in DBPro and position and scale them?

Any reason to use the cube?

Sanguis
15
Years of Service
User Offline
Joined: 10th Jan 2011
Location: Deutschland
Posted: 16th Jan 2015 20:39
The reason why I use a cube is, because this will be my room later. I know this way from mapping for some games. Fo me it is the fastes way, to get the room I want.

~ And when I sometimes clos my Eyes, my mind starts, spinning around.
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 16th Jan 2015 21:00
For the hollow cube approach, you will likely need to make sure the object face normals point inwards. Cubes will point outwards by default.You should be able to do this in the modeling package, or just scale the object in dbpro by negative 100 on all axes. Maybe you've already done this? It's not clear how exactly you went about making it "hollow"

Login to post a reply

Server time is: 2026-07-05 03:50:35
Your offset time is: 2026-07-05 03:50:35