Harton
Member
|
Access to objects
While writing the tools I need access to the container objects in the scene. Is it possible to get an easy way to objects in the world? How can I get a pointer to the object it points to the mouse?
|
|
04-05-2012 08:54 PM |
|
JonathonA
Member
|
RE: Access to objects
Hi Harton, not sure if this is what you are looking for but the Game::World.init(...).setObjType(...) is used to define containers to store objects from the world so I imagine you can access them through that?
To get the object under the mouse you'd have to cast a ray I imagine and if it collides with something then the PhysHit class I believe contains a pointer to whatever it has collided with.
|
|
04-05-2012 09:42 PM |
|
Harton
Member
|
RE: Access to objects
Hi JonathonA!
Function 'Edit::World.setObjType' changes class which manage objects of type specified in the argument.
Raycast, I completely forgot. Just try it. Thanks.
(This post was last modified: 04-05-2012 10:25 PM by Harton.)
|
|
04-05-2012 10:22 PM |
|
Harton
Member
|
RE: Access to objects
Unfortunately, the raycast method did`t work. Received pointer is random and incorrect.
|
|
04-07-2012 05:40 PM |
|
Zervox
Member
|
RE: Access to objects
Physics.ray isn't random it returns what the mouse screen to pos matrix would hit. Unless there is something else you mean by random?
|
|
04-07-2012 08:51 PM |
|
JonathonA
Member
|
RE: Access to objects
Describe how its incorrect if you can, might help narrow down the problem and maybe post code
|
|
04-07-2012 09:03 PM |
|
Esenthel
Administrator
|
RE: Access to objects
there is no physics in the world editor.
there are only EE::World.obj,objs which allows to get object params and position
if you want I can enable isSelected isHighlighted methods for world object (EE::Edit::Obj) in the edit stage, just let me know
|
|
04-08-2012 09:06 AM |
|
Harton
Member
|
RE: Access to objects
Maybe I'll explain what I want to do.
I would select object using mouse and next I would like set objects group which I can show or hide in game. Now I can't receive pointer to object. I don't know how can I select object in world.
|
|
05-03-2012 07:20 PM |
|
Esenthel
Administrator
|
RE: Access to objects
why not set custom parameter for the object in object mode?
you have Ms.pos(), ScreenToPos, PosToScreen, World.obj, World.obj[i].pos()
|
|
05-04-2012 05:13 AM |
|
Harton
Member
|
RE: Access to objects
Thanks! A different approach and I got lost. I was able to select objects but selection is quite crude.
I wish I could select objects as it is nicely done in the 'Object' bookmark in the World Editor. Would you like to help me sample code?
At this moment the biggest difficulty for me to detect the object boundaries.
|
|
05-05-2012 05:00 PM |
|