How to map the object references

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

How to map the object references

Post by cc9cii » 23 Oct 2014, 06:27

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: 5134
Joined: 06 Aug 2011, 15:16

Re: How to map the object references

Post by Zini » 23 Oct 2014, 08:25

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: 434
Joined: 28 Mar 2013, 04:01

Re: How to map the object references

Post by cc9cii » 23 Oct 2014, 09:09

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: 2085
Joined: 18 Feb 2012, 11:51
Contact:

Re: How to map the object references

Post by scrawl » 23 Oct 2014, 17:00

Derive a class from btRigidBody (like in OpenMW), and store some sort of ID there?

User avatar
cc9cii
Posts: 434
Joined: 28 Mar 2013, 04:01

Re: How to map the object references

Post by cc9cii » 23 Oct 2014, 19:48

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

Who is online

Users browsing this forum: No registered users and 3 guests