Pick additions: Group

Blitz3D Forums/Blitz3D Programming/Pick additions: Group

Damien Sturdy(Posted 2004) [#1]
I can't remember if i posted this already, feel free to kick me if i did. WHile reading a topic, i remembered:

My idea is to have EntityGroup command.


OKAY so here comes my solution:

EntityGroup Entity,Group
Linepick entity,...........,[group] (to search only entities given a certain group)


This would allow you a LOT more control over each pick and alot more speed- which will alow for more tricks and stuff in AI and things.
I can't stress how much i needed this in recent weeks!


At the moment, When using the pick commands, it searches EVERY SINGLE entity with a pickmode, yes?
what if you have 24 cars and a terrain. (simple example)

each wheel of each car picks below it- and gets the terrain. at this point its also checking the other 24 cars. waste of speed.

The main speed issue: you may want to use the pick commands between cars (say, for user collisions and AI)... at this point, youre just doing a pick between cars. BUT, each pick also checks the polygons of the terrain!

Anyway, what does everyone else think of this?


Picklesworth(Posted 2004) [#2]
*kick*
:)

You could write your own system for this that uses hideentity and showentity, or changes entitypickmode, or something along those lines.


Damien Sturdy(Posted 2004) [#3]
heh, bad memory here... :P

good idea there... il have to write a generic entity management system too..

Well, ill get onto it.

[edit]

with how efficient i can code (not very!) i doubt thisd be much faster >.< heh.

It WOULD be a good addition though, dontya think?


poopla(Posted 2004) [#4]
No need to add this to b3d, it would just be bloat. Just do this. When you want to pick your entity group, go through all your entities and hide any that aren't in the group ya want to pick from, like pickles up there said.


AntonyWells(Posted 2004) [#5]
You can do it already,

Function newGroup()
   return createpivot()
end function

function addEntity(group,entity)
   entityParent entity,group
end function

function GroupCollision(Group,Enable)
   if enable showEntity group else hideEntity group
end function



hiding the group pivot, hides all it's children, also culling them from any collision tests.


Damien Sturdy(Posted 2004) [#6]
heh
Cheers.

Anthony, thats the simplest explanation, never expected it to be that easy!
And i thought something remarkably simple- parenting everything to a pivot (hidden, never to be moved.) then when i hide that, poof.thas realy quite usefull for a few routines of mine

Cheers again you guys :)

[edit] Just found an old system of mine, and thought "cool! i made this?" its a huge chunk of code that does exactly the same as Anthony's code above. Lol..


Damien Sturdy(Posted 2004) [#7]
I'd just like to add that because ive just found the other EntityGroup command, My command be changed to EntityPickGroup! hehe.. Thats what i get for not reading around :)