How to map the object references

Involved development of the OpenMW construction set.
Post Reply
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

How to map the object references

Post by cc9cii »

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?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: How to map the object references

Post by Zini »

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?
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: How to map the object references

Post by cc9cii »

getUserObjectBindings()
Didn't even know these things existed :oops:

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:
We can easily change this to storing the object’s MWWorld::Ptr instead of the scene node name.
Unfortunately we don't have that in OpenCS.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: How to map the object references

Post by scrawl »

Derive a class from btRigidBody (like in OpenMW), and store some sort of ID there?
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: How to map the object references

Post by cc9cii »

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.
Post Reply