This discussion is archived
1 Reply Latest reply: Dec 9, 2010 5:37 PM by 802991 RSS

Java 3D changing behaviour dynamically

808952 Newbie
Currently Being Moderated
I need to implement several different mouse behaviours (tools) for a Java 3D scene. These would include rotate, translate, zoom, selecting and moving objects etc. A toolbar will be used to select which tool is currently in use.

When a new tool is selected, the current behaviour needs to be removed from the scene and a new behaviour added (to the same node or perhaps a different one). How is this normally done?

To add the behaviour as a child I need to remove the element from the scene graph so it is no longer live (adding to a live node causes an exception). Will this make the screen flicker?

Alternatively, I could use a proxy behaviour, which is permanently attached to the scene graph. The functionality could then be changed using delegation (ie strategy pattern).

Or can I just not use behaviours at all, just act on teh scene graph directly? Any downsides to that?
  • 1. Re: Java 3D changing behaviour dynamically
    802991 Newbie
    Currently Being Moderated
    Strange, when I saw the first 4 lines, I thought to myself: +'Is he trying to construct Minecraft?'+

    But on topic: I would not know how one would do this, but Markus "Notch" Persson, or the creator of Minecraft, actually has these implemented in his java game. Try asking Notch on his twitter. I am sure you will find exactly what your looking for (besides the zoom), if he helps you. :)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points