Orbit Camera

I see some interesting code for an orbit camera here:

But the code dates from 2009 and is heavily outdated. Does someone have a port that works with the current engine?

I tried porting it, but it is way to complex for me to find out where to find the succesors of deprecated classes and how to use them.

Take a look at the following camera controllers:

Physics-based OrbitCamera


orbit camera
What does it look like?
Do you have a video?

Something like this:

Demo code:

1 Like

It seems the Chase Camera could do the trick
Garrett seemed like a good choice and although I had finished my orbital camera, I still wanted to try Garrett :grinning: :grinning:

Chase Camera looks promising, but I have some trouble understanding how to get my mouse output. The documentation seems to leave out vital information.

1 Like

What kind of output do you need the mouse to produce? Can you describe it in detail?

What I need is a way to detect the mouse moving, buttons being held down and the scroll wheel.

MouseMotionEvent and its friends look very promising, but the documentation does not show exactly how to write my own events handles.

It would be great to have a simple example that does nothing more than write the mouse coords to the output - but in the most simple way possible. With all imports needed.

Most examples in the documentation I see lean heavily on what is already available in the SimpleApplication-class without explaining what it is, what it does and where it comes from. The JavaDocs are not very user friendly for beginners like me and they do not tell a lot.

Here is what I am working on, just for fun. Currently I use the default camera.

1 Like

I wonder if this will help you

Most of this content can be found in Javadoc. To get started you may need to browse wiki.jmonkeyengine.org

This seems like it might help you, too

Haha, I did browse the Wiki thoroughly, but it is not always very helpful. The examples leave out a lot of details that make it hard to implement them.

In this case, it dives immediately into this mapping stuff. I only need a way to attach my own code to a mouse event. The documentation suggests that it is possible using MouseMotionEvent but never tells how. It took me hours to figure where inputManager came from, but still it is not clear if this is what I need for my simple game.

With the code you shared: where do I invoke this in my code? And where do I go from there?

If you want to control something with the mouse then first you have to register the listener

You may also want to Add Custom Trigger Mapping

package net.jmecn;

import com.jme3.app.SimpleApplication;
import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.MouseButtonTrigger;

 * 用户交互
 * @author yanmaoyuan
public class HelloInput extends SimpleApplication {

	public static void main(String[] args) {
		HelloInput app = new HelloInput();

	 * 开火消息
	public final static String FIRE = "Fire";
	public void simpleInitApp() {
		// 绑定消息和触发器
				new KeyTrigger(KeyInput.KEY_SPACE), 
				new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
		// 绑定消息和监听器
		inputManager.addListener(new MyActionListener(), FIRE);
	// 监听器
	class MyActionListener implements ActionListener {
		public void onAction(String name, boolean isPressed, float tpf) {
			if (FIRE.equals(name) && isPressed) {


This is a simple example