Collisions of entities and Bmax types

Archives Forums/Blitz3D SDK Programming/Collisions of entities and Bmax types

Robert Cummings(Posted 2007) [#1]
Hello,

I want to retrieve an entity involved in a collision then look up the type containing it. Is there an Entitydata or such command which will hold the handle to my Bmax type?

If not, what do you recommend I do?


big10p(Posted 2007) [#2]
The old Blitz3D trick is to stuff the type handle (using Handle() command) into the EntityName. Then, you can retrieve it using the Object() command. Not sure if you can do that in bmax though, TBH.


Robert Cummings(Posted 2007) [#3]
Yep and the old handle trick would crash on some machines. Not sure why it did.

I think I'll have to check the hard way, but it will be somewhat slow.

Keep the suggestions coming please.


Avon(Posted 2007) [#4]
Not sure if this helps, but the new "bbSetEntityID" and "bbEntityID" commands might be useful. Code courtesy of skidracer:

' store the owner object in the entityid when you create it
bbSetEntityID(entityhandle,HandleFromObject(myobject))

' lookup owner object from entityhandle with following
myobject= HandleToObject(bbEntityID(entityhandle))



Beaker(Posted 2007) [#5]
Would be nice if SetEntityID and EntityID() crossed over into the next BB3D update as well.


Robert Cummings(Posted 2007) [#6]
Most intriguing! thank you I will look into it.

So...

bbSetEntityID( sphere , HandleFromObject( mytypehandle ) )

and say it collides?

myobj = HandleToObject(bbEntityID( collidedEntity ))

myobj.health :- 10

very nice! Avon you have become a valuable and helpful chap :)


big10p(Posted 2007) [#7]
Hmm, those new commands just look like the existing Handle/Object commands have been formally wrapped for the SDK. Would still be nice to have them in Blitz3D though, and make that functionality 'official', at last. :)


Robert Cummings(Posted 2007) [#8]
Yes why not? but this means finally it can be very quick to look up entity data!


Robert Cummings(Posted 2007) [#9]
Having problems getting it working. Any examples?