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 Discussion / 3D Model problems

Author
Message
Enlightened Gamer
14
Years of Service
User Offline
Joined: 4th Oct 2009
Location:
Posted: 4th Oct 2009 21:55
Hey guys,

I am a student and kind of new to the whole DarkBasic world. I am creating a first person shooter for my first project but when I lock the 3D weapon on to the camera I get a problem.

The 3D model becomes very weird. You are able to see into the middle of the model as if the top layers have been removed (like if you position a object on the matrix and walk into it a little bit).

I lock the model to the camera using the "lock object on" command as it is a lot simpler then positioning the model just infront of the camera and getting the ground hide of the camera and making it rotate with the camera etc.

When the models (I have tried more then one) are just positioned on the matrix they look how they are meant to so it should not be the models fault (I even tried with the models provided in the media area and the examples).

Can anyone explain the reason that this is happening?
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Oct 2009 01:21 Edited at: 5th Oct 2009 01:23
Hello and welcome to the forums!

I remember this problem, but never really went into it. Are the normals on the model 1-sided or 2-sided?

When you lock an object on to the screen, the "position object" command will position the object assuming the camera is point 0,0,0. So maybe you are not offsetting it from the camera correctly and the camera is looking into the model?

Seriously, I am having problems with this too. If I have a model (just like you), lock it to the screen and rotate it around and around, it seems the normals are reverted and you only see the inside of the model, but the outside has disappeared... I'd be happy if someone can solve this problem.

TheComet


Make the paths of your enemies easier with WaypointPro!
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 5th Oct 2009 01:33
You probably don't have your camera range set to a near enough value, try adding this to the start of your code...

"set camera range 0.2, 1000000"

Hope that helps

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Oct 2009 03:26
I thought that the nearest camera range was 1?

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Oct 2009 10:30
@Enlightened Gamer
Quote: "I lock the model to the camera using the "lock object on" command as it is a lot simpler then positioning the model just infront of the camera and getting the ground hide of the camera and making it rotate with the camera etc.

When the models (I have tried more then one) are just positioned on the matrix they look how they are meant to so it should not be the models fault (I even tried with the models provided in the media area and the examples).

Can anyone explain the reason that this is happening?"

Hello.

While Lock Object On is convenient, it's not really too great for locking guns or tools to the camera perspective. What happens, and what seems to be what you are describing, is the clipping planes (the viewing area in which 3d is drawn) for the object that is locked is handled a little differently than non-locked objects. Objects within a certain proximatey to the camera can appear 'clipped' or not completely drawn. The Z-Depth (a control that allows one object to be drawn in front or behind another object) is disabled for the locked object and that object will always appear in front of other objects. The clipping combined with the Z-Depth (and other things) can make your locked objects seem partially see-through or like they are missing some parts. There's no correction that I know of except for not using Lock Object On for weapons.

It's best not to use Lock Object On for guns or anything carried. It works best for 2d type displays like a radar or a map or control panel that is always displayed on screen and projected onto something like a plane. It's much better to position the object with math or with limbs.

Here's a quick example of using a cylinder as a gun and attaching it as a limb to a cube that is rotated and placed at the camera's position and orientation. Steer with the mouse, move with the up/down arrows:



Enjoy your day.
Enlightened Gamer
14
Years of Service
User Offline
Joined: 4th Oct 2009
Location:
Posted: 8th Oct 2009 01:37
Thanks for the advice.

I did try to position the object using simular code as you gave as a example but I had trouble with getting the rotate right.

I will give it another go tho!
teiran7
14
Years of Service
User Offline
Joined: 26th Oct 2009
Location:
Posted: 27th Oct 2009 03:12
Im havin a problem uploading models. Im using dark basic 1.13. When I convert my object in deep exploration to a .x file, it's an ASCII file, and dark basic cant read this file. Is there a way I can maybe compile it or convert this file into the right .X file.

Login to post a reply

Server time is: 2024-05-04 05:29:30
Your offset time is: 2024-05-04 05:29:30