This is in relation to Feature #1278, Editor: Mouse picking in worldspace widget. I've got some basic code working to be able to choose an object on screen. The picking is done using bullet (basically lifted & adapted some code from openmw). If anyone is interested it is here, unfortunately still with debugging code all over the place (but mouse picking seems to work well).
The problem: I'm a little unsure how to get the referenceable id or reference id of the selected object. (I assumed we need that in order to be able to move/rotate/delete/copy/etc the object) One easy way is to keep a map of all collision objects created for a reverse lookup later, but is there a better way to trace a scene node name back to the object reference?
How to map the object references
Re: How to map the object references
You will need the reference ID. The referenceable ID is useless in this context.
I would have advised to set the scene node handle to the reference ID, but as scrawl pointed out recently these handles will go away in OGRE 2.0. Therefore we should not write new code that will depend on them.
The only other thing I can come up with is to use getUserObjectBindings(). @scrawl: Any better ideas?
I would have advised to set the scene node handle to the reference ID, but as scrawl pointed out recently these handles will go away in OGRE 2.0. Therefore we should not write new code that will depend on them.
The only other thing I can come up with is to use getUserObjectBindings(). @scrawl: Any better ideas?
Re: How to map the object references
Didn't even know these things existedgetUserObjectBindings()
EDIT: but they work with scene nodes, no? If the handles go away then can't use these either?
EDIT2: According to scrawl's blog:
Unfortunately we don't have that in OpenCS.We can easily change this to storing the object’s MWWorld::Ptr instead of the scene node name.
Re: How to map the object references
Derive a class from btRigidBody (like in OpenMW), and store some sort of ID there?
Re: How to map the object references
Thanks for the idea. I'm already using Rigidbody from OEngine, but just like OpenMW passing the scene node handle as the "name". I'll try passing the reference id into it instead.