How highlight a single object in a scene when select the object?

Hello, i have a common question, i think many guys would have this requirement when use JME3:

In a scene, i have create many objects (many nodes which attached to rootNode).

Now, i want all objects can be selected by clicking mouse button, and would show a border (or means outline) on the selected object edge.

I know many guys suggest to use the CartoonEdgeFilter, but as i have look though it’s source code, this filter would effect to whole scene, so it’s not satisfied to my requirement that i only want to effect to a single object in the scene.

2 Likes

There are several ways to do this and several drawbacks and benefits from each approach. Personally, I’d clone the selected node, re-scale it by 1.01 and render it with Meshm.Mode.Line. Highlighting done :wink: Another way to do it is to create a selection box that you use to make the bounding volume visible - as i said, there are many ways.

You could also switch the material on the selected item to put in an edge glow shader or something (take a look at Maker’s Tale for example).

1 Like
@polygnome said:
There are several ways to do this and several drawbacks and benefits from each approach. Personally, I'd clone the selected node, re-scale it by 1.01 and render it with Meshm.Mode.Line. Highlighting done ;) Another way to do it is to create a selection box that you use to make the bounding volume visible - as i said, there are many ways.


Hi polygnome,
Many thanks for you suggested ways.
For the first way, i don't understand "render it with Meshm.Mode.Line", can you tell me the details how to render with this way?
For the second way, it seems the bounding volume always be a box(cube)? But i would like a border attach to the edge of node (also for irregular node).
@zarch said:
You could also switch the material on the selected item to put in an edge glow shader or something (take a look at Maker's Tale for example).

Hi zarch,
Thanks for your another suggestion.
Regarding the "edge glow shader", could you give me some examples which shaders can achieve this effects?
BTW, what's the "Maker’s Tale"? Could you give me a link or something where i can find them?

“Maker’s Tale” is a project.



http://hub.jmonkeyengine.org/groups/user-code-projects/forum/topic/makers-tale-tech-demo-first-release/

http://hub.jmonkeyengine.org/groups/user-code-projects/forum/topic/makers-tale-tech-demo-walkthrough-video/

http://hub.jmonkeyengine.org/groups/user-code-projects/forum/topic/makers-tale-tech-demo-update-video/



and i think he mean one of this shaders:

http://code.google.com/p/jme-glsl-shaders/

1 Like

Hi All,

I have the same problem as longyg. Follow this video showing how i can add and link models to a scene in jMonkeyPlatform:

[video]jMonkeyEngine SDK Alpha-2 (Scene Composing) - YouTube

As the result, i added some cars into the scene.

My question is how to pick up objects (my added cars) in this scene ( as an example https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_picking ) ?

Thanks for any suggestions.

Anyone can answer my question ?

Many thanks to you.

You asked a question with almost no information and then provided the answer yourself that we were likely to give.

You may need to explain why that tutorial was insufficient to answer your question.

1 Like

Hi pspeed, sorry for my not good question. I try in this post to ask again in more details.

  • I used jMonkeyEngine SDK to add some objects in my scene.

For example, followed the guide in this video jMonkeyEngine SDK Alpha-2 (Scene Composing) - YouTube, i added some cars objects in my scene. Each car object was attached by each different node.

  • i want now all objects can be selected by clicking mouse button (using fixed crosshairs) and i can get their corresponding node.

I hope it was clearly.

@qa.nguyenvu said: - i want now all objects can be selected by clicking mouse button (using fixed crosshairs) and i can get their corresponding node.

Use the beginner:hello_picking you already found.

I think the part you are not looking into is the geometry that you receive form the collision result Geometry JavaDoc the getParent method comes form Spatial witch Geometry inherits from.

[java]
// 5. Use the results (we mark the hit object)
if (results.size() > 0) {
// could be the node you are looking for
Node yourNode = results.getClosestCollision().getGeometry().getParent();
/*
* Do stuff with your node
*/
}
[/java]

if the node you get back is not the node you are looking for you need to check the hierarchy of you mesh in the seen composer or just start learning about controls . :wink:

1 Like