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.

Newcomers DBPro Corner / how to detect objects on the same location?

Author
Message
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 7th Jun 2010 18:45
hey all, iam still busy with my editor (and will be for the next few months ), but got a little problem:

if i build in my editor, some of the objects will be placed on the same location, how can i detect how many objects are on that location, and how to delete them automatically?

many thanx for who knows the answer!

*happy coding on his 3D Sandbox Editor*
zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 7th Jun 2010 19:05
Hmm.. What do you mean they are placed on the same location. Like an object is being cloned or duplicated at (for instance) 0, 0, 0?

You may want to code in some collision to test an object before it is placed. Maybe if an object is colliding with another object, they can both be highlighted in red and can prompt you "Are you sure you want these two objects to intersect? Yes/No" before you place it?

Also, you may be able to do a multiple raycast from sparky's dll to return a checklist of objects at a certain spot. I wouldn't know how since I have never messed too much with multiple raycasting (I just read the directions of use,) but I would think this would be possible.

My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 7th Jun 2010 22:22
hmm i just deleted all collission code because i didnt need it.

i use instance object. isnt there a dbpro command to see if there are more objects on the same location? and maybe i need to make a small movie to explain what iam doing...

*happy coding on his 3D Sandbox Editor*
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 7th Jun 2010 23:03
Normally with an object placement editor, you allow the user the ability to place things where they wish. Once the user indicates that they want to place the item, you can store the coordinates in an array or TYPE variable. If you wanted to delete items at that location, you just check through your array/TYPE variable list to see how far away the items are.

That said, perhaps you are randomly-generating placement of items/rooms/whatev, in which case you still could store the data and check it to see if other items are nearby.

If it is the user placing the items, you could easily check the array/TYPEs for too many items in one area and warn them prior to placement also.

Hope this is what you are looking for, but I'm not sure exactly what you are working on.

LB
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 8th Jun 2010 00:06
see movie:

http://www.youtube.com/watch?v=9IBiW0hH1Ks

the last beam i place in that movie has a blue connector, that connector will be placed over another blue connector what was already there...

so iam ending like multiple objects on 1 location.

Quote: "you can store the coordinates in an array or TYPE variable. If you wanted to delete items at that location, you just check through your array/TYPE variable list to see how far away the items are."


but wouldnt that going to be slow with 1000+ objects? (because i made a small tower and thats has already 600+ obejcts)

*happy coding on his 3D Sandbox Editor*
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Jun 2010 00:29
So you're building towers piece by piece (well, object by object)?

If other objects are there, why don't I see them in the vid?

Quote: "but wouldnt that going to be slow with 1000+ objects? (because i made a small tower and thats has already 600+ obejcts)"


In order to determine if another object is there, you'll have to do some sort of checking; looking at the array would be relatively quick, though not instantaneous. It might help if you break down the locations by quadrant. i.e. when the object is placed initially, you look at the coordinates and place it within one of four quadrants (or whatever number works for you). Then you can look at what quadrant you are in when placing a new object and only check against those objects that have been placed in that quadrant.

Wow, a small one is 600+ objects? Are you going to have a good enough framerate with all of those objects in place?
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 8th Jun 2010 00:55
Quote: "So you're building towers piece by piece (well, object by object)?"


yes

Quote: "If other objects are there, why don't I see them in the vid?"


see the last beam i set in place, it has a blue connector at the end, there will be always a connector at the end. if i place it theres already a blue connector there. and because they are on the same location you cant see the second one.

Quote: "Wow, a small one is 600+ objects? Are you going to have a good enough framerate with all of those objects in place? "


yes, i set the framerate on 100, and it still gets 100fps on 1024x768pix
(i did a test if i dont load my tower, then i get 1044fps
if i load the tower i get 200fps) (so i wonder how many objects will my program go down to 30fps?)

do you have a small example how to check the array?

*happy coding on his 3D Sandbox Editor*
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 8th Jun 2010 01:56
If i assume you are still using my find the cube side system from before, it can be used for your non connector objects.

When you add your connector at the beginig you can make so the next step do not add a connector next to your object automaticly, but using the system for the connectors place 1 dummy object to the side of the object where connector is not pressent and if there is mouseclick add manually a connector then again an object and so on.

This is the first that cross my mind, there can be better solution as allways.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Jun 2010 06:00
Quote: "do you have a small example how to check the array?"


I came up with something that is better and faster, using vector3. The following code creates 600 cubes and places them randomly. You then can move the camera using the arrowkeys. The code checks for the nearest cube and reports it. You can move around pretty fast and it updates the nearest one faster than you can read it.



I hope this is helpful.

LBFN
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 8th Jun 2010 12:59
@luskos

i had it already so, but building a tower/whatever was slow. so i thought to add the connector for faster building.
i made that tower, with the blue connector automatically added, in +- 10 min... so you can really fast build something with many objects in it.


@LBFN

thank you for your effort to make e example. i will examine your code piece today.

*happy coding on his 3D Sandbox Editor*
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 8th Jun 2010 13:20
I didn`t mean to cut the connectors at all but just do not place them automaticly with your joint object.When you add joint you can add connector manually.

I would make drop down menus with right click select an option to make a connector and then selecting on of its sides again from the menu while the mouse is over the connector select joint then with mouse on the join connector.

The menus are very easy made with Brandy Boy`s BBB plugin, and their configuration is pretty easy too.It`s very nice plugin for menus.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 8th Jun 2010 14:05 Edited at: 8th Jun 2010 16:08
i made a temporary solution: if i hold the ctrl key the blue connector is not placed at the end and if i let go then the blue connector will be added automatically again.



but still looking to do this automatically. and still looking into lbfn piece of code.

edit:

its a nice example lbfn, but i cant nothing with it, beacuse it checks the closest object by the camera, and what i want is to detect if there already a object is on a location. and not by the camera.

*happy coding on his 3D Construx Editor*
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Jun 2010 17:11
Quote: "its a nice example lbfn, but i cant nothing with it, beacuse it checks the closest object by the camera, and what i want is to detect if there already a object is on a location. and not by the camera."


All you have to do is supply the X, Y and Z coordinates where you want to check and it will calculate the distance in the function. I merely used the camera location, but you can use whatever coordinates you want.

LB

Login to post a reply

Server time is: 2024-09-28 18:24:51
Your offset time is: 2024-09-28 18:24:51