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.

Dark GDK .NET / Removing objects from 3d space?

Author
Message
SOTSOG FPS GameCreators
15
Years of Service
User Offline
Joined: 5th Apr 2008
Location:
Posted: 1st Sep 2010 18:12
Hi all
i've got a problem, my form consists of a listbox populated with characters filenames and a button which when a item from the listbox is selected will place that character in the viewport. this works perfectly fine with no issues.
selectchar is a shared string variable, and charselect is a shared DarkGDK.Basic3D.Object3D

here is the code in my sub to add a character to the viewport:



i've also got another button which as you've guessed removes a selected character from the viewport but it isn't working.

here is the code in my sub to remove a character from the viewport:



any help would be great thanks.
Yoda Master
16
Years of Service
User Offline
Joined: 23rd Feb 2008
Location: Genova
Posted: 2nd Sep 2010 09:38
Can you be more specific? What do you mean with "isn't working"?

ByteStorms
Bytes from incoming years
www.bytestorms.com
SOTSOG FPS GameCreators
15
Years of Service
User Offline
Joined: 5th Apr 2008
Location:
Posted: 2nd Sep 2010 15:15 Edited at: 2nd Sep 2010 15:41
i select two characters and load them into the viewport in front of each other, if i select the one at the back(the first one i placed in the viewport) then the camera just moves back away from the characters, and if i select the at the front(the second one) the camera moves forward. thats all it does.
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 2nd Sep 2010 21:30
Your problem is in your delete Code Snippet:



You are creating a new Object3D object everytime you ask to delete it. Variables work differently from DarkBasic (if you came from it).

[center][center]
SOTSOG FPS GameCreators
15
Years of Service
User Offline
Joined: 5th Apr 2008
Location:
Posted: 3rd Sep 2010 00:26
i deleted the
.which kind of worked, but my problem now is that if i load two or more characters into the viewport, it doesen't matter which one i select from the lisbox to delete, it will just delete the last one loaded.do i need to create some sort of array to hold the order that the characters were loaded in the first place?
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 3rd Sep 2010 16:02
Unfortunately I'm at work now and will be away from home for the next 10 hours, and I do not have DGDK.NET available here. But I'll try to put up a small demo of what you may do when I get back.

[center][center]
SOTSOG FPS GameCreators
15
Years of Service
User Offline
Joined: 5th Apr 2008
Location:
Posted: 3rd Sep 2010 23:23 Edited at: 3rd Sep 2010 23:27
ok thanks that would be great. i've been programming in visual basic for about six months, but i'm brand new to DarkGDK.NET, so i'm having to learn about dealing with stuff to do with the 3d side of things.
Yoda Master
16
Years of Service
User Offline
Joined: 23rd Feb 2008
Location: Genova
Posted: 7th Sep 2010 17:22
You should keep every object instance in array, or any data structure that would let you to retrieve an object by a key (like a Dictionary).

For example, you store the key of objects (it may be the Id property value or a value generated by you) in the listbox, then you hold Basic3D objects in a dictionary where keys are the same in the listbox and that's all.

I hope I was able to explain clearly what I mean.

Regards

ByteStorms
Bytes from incoming years
www.bytestorms.com
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Sep 2010 20:16
use the list items .Tag (or atleast they got .Tag in TreeViews) to store the ObjectID or some shiet like dat

need moar

Keep it simple.
Questions? Mail me

Login to post a reply

Server time is: 2024-02-23 20:48:28
Your offset time is: 2024-02-23 20:48:28