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 / Vertexdata problem

Author
Message
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 10th Sep 2012 23:43
Hi,
I'm currently working on a sandbox-style game involving building and survival in a (hopefully) smooth, infinite world... Think Minecraft without the blocks, but terrian instead! I've come to the conclusion that using a terrain or matrix object for the world is impossible, since terrains don't support overhangs and enclosed areas (for example, as far as I'm aware, there is no way with either terrain objects or matrices to create a horizontal underground tunnel with a roof). I'm guessing the only way this is possible is by holding the terrain as a regular 3d object. As far as I'm aware, this means that the only way to edit it on the fly is by using vertexdata manipulation, an area of DarkBASIC Pro I've never really played with.
Over the last two weeks, I've been playing around with and testing the vertexdata commands.
In the game, what I want to happen is for the player to build when right-clicking, and dig when left clicking. If you build, or indeed dig, you'll need to be creating new vertices, positioning them to make a wall that grows the longer you hold down the mouse if you're building. The only way this seems possible is by using 'add mesh to vertexdata'
Ok, so, the question I want to ask is what's wrong when I try to use add mesh to vertexdata on any object less complex than a cube. When I use the add mesh to vertexdata statement, the original object vanishes. I can't find it anywhere in 3d space, it simply seems to have become invisible, along with the new mesh added to it. What is going wrong here? I can't find the problem :/
The reason I included all the extra detain about my project is I also wanted to ask what you think of it's practicality, do you think it's possible?
Thanks for any answers!

P.S. Not sure this post makes 100% sense, typing this while very tired, sorry
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 10th Sep 2012 23:49 Edited at: 10th Sep 2012 23:50
To be a little more specific, the problem I'm having is when doing the following (condensed down to bare minimum code):

It's at this point that the object dissapears
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Sep 2012 01:24
Do both meshes have the same FVF format?
DBPro-generated primitives use either 274 or 338 I think.


"Why do programmers get Halloween and Christmas mixed up?"
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Sep 2012 01:44
I'm not sure but I suspect you need to use lock vertexdata for mesh.

Have a look at this thread:

adding mesh data

and this snippet:



You'll need to do a bit more to get both sides of the new object to show (DBPro plains are a bit special) and other things may need fixing but at least you'll be able to see something.
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 22nd Sep 2012 03:09
Hi,
Thank you both for your responses, althought Green Gandalf managed to crack the problem for me
Using meshes as opposed to limbs seems to be the solution, thanks!

Login to post a reply

Server time is: 2026-07-08 14:11:04
Your offset time is: 2026-07-08 14:11:04