Move camera vs object with mouse... Recommended method?

Have jReality programming problems or questions? Post them here.
Post Reply
ted
Posts: 57
Joined: Wed 25. Jul 2012, 22:53

Move camera vs object with mouse... Recommended method?

Post by ted » Tue 21. Aug 2012, 23:07

I want my scene to be fixed with respect to the SkyBox so that navigating simply moves the camera, and the scene will appear fixed to the ground. What is the recommended way of doing this? I don't want to mess with the core code if there's already a setting for this. I suppose I could take over the mouse events and calculate the transforms myself, but I'm wondering if this is already supported in the Viewer somewhere, maybe I shouldn't reinvent it.

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Move camera vs object with mouse... Recommended method?

Post by gunn » Mon 3. Sep 2012, 11:01

Try the tool de.jreality.tool.tools.ShipNavigationTool. I'm not completely familiar with it, but if you add to a node "one above" the node containing the camera, it responds to the arrow keys to fly towards, away, to the left, or to the right.

There is also a class called FlyTool which responds only to up arrow and down arrow.

If these tools don't do what you want, at least they may provide you with a template for writing your own camera fly tool.
jReality core developer

ted
Posts: 57
Joined: Wed 25. Jul 2012, 22:53

Re: Move camera vs object with mouse... Recommended method?

Post by ted » Tue 4. Sep 2012, 07:18

tried this

Code: Select all

		RoboticSystem scene = new RoboticSystem();
		final Viewer viewer = JRViewer.display(scene);
		viewer.getSceneRoot().addTool(new ShipNavigationTool());
and this

Code: Select all

		RoboticSystem scene = new RoboticSystem();
		final Viewer viewer = JRViewer.display(scene);
		viewer.getSceneRoot().addTool(new FlyTool());
The background stays stationary while the foreground moves in either case. I'm just going to try to disable the mouse or use a different viewer. I've tried doing this:

Code: Select all

        JRViewer v = new JRViewer();
 
        v.addBasicUI();
        v.addVRSupport();
        v.addContentSupport(ContentType.TerrainAligned);
        v.registerPlugin(new ContentAppearance());
        v.registerPlugin(new ContentTools());
        v.setContent(SceneGraphNode contentNode);
 
        v.startup();
and commenting out lines with addVRSupport() and ContentTools(). I can comment them out to get the mouse to stop moving, but then it won't let me browse the tree. I suppose I need to look that up, but I'll probably just use the opengl Viewer class directly and give up that added functionality.

I need to move on & get a paper out this week so it may be awhile before I spend more time on this problem unless the solution is trivial. I'll be using the ...jogl.Viewer directly instead without the tree.

Thanks.

_-T

Post Reply