pspeed
Wouldn’t be hard to link them then right? If Your code is posted in 3 or 4 topics already. Of course I dag through every camera-related topic here and never found an exhaustive answer from You but, well… My vision isn’t perfect.
As for second part of Your answer - is scaring people away from this forums Your job? Because if You don’t want to help it’s fine - I just don’t see the reason to slap semi-answers here and there that may-or-may-not point someone in right direction but never solve anything completely. Try such behaviour on StackExchange, I dare You.
bloodwalker
Looks like we think in similar way. Before You answered I managed to do the grabbing thingy this way:
private CameraNode cameranode;
private Boolean drag=false;
private void initKeys() {
inputManager.addMapping("Drag", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addMapping("Left", new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping("Right", new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping("Up", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping("Down", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addListener(analogListener,"Left", "Right", "Up", "Down");
inputManager.addListener(actionListener,"Drag");
}
private ActionListener actionListener = new ActionListener() {
public void onAction(String name, boolean keyPressed, float tpf) {
if (name.equals("Drag") && keyPressed) {
drag = true;
}
if (name.equals("Drag") && !keyPressed) {
drag = false;
}
}
};
private AnalogListener analogListener = new AnalogListener() {
public void onAnalog(String name, float value, float tpf) {
speed = 25;
if (drag) {
if (name.equals("Right")) {
Vector3f v = cameranode.getLocalTranslation();
cameranode.setLocalTranslation(v.x + value * speed, v.y, v.z);
}
if (name.equals("Left")) {
Vector3f v = cameranode.getLocalTranslation();
cameranode.setLocalTranslation(v.x - value * speed, v.y, v.z);
}
if (name.equals("Up")) {
Vector3f v = cameranode.getLocalTranslation();
cameranode.setLocalTranslation(v.x, v.y + value * speed, v.z);
}
if (name.equals("Down")) {
Vector3f v = cameranode.getLocalTranslation();
cameranode.setLocalTranslation(v.x, v.y - value * speed, v.z);
}
}
}
};
And it works lovely. Scaling the speed so it actually looks like “grabing screen” was a pain but I believe 25 is as close as I can get.
Anyway great thanks man. You were a lot of help. Hope more people were like You
Which leaves me with one last scenario to learn (funny thing, it’s the one I started from) which is FPS-style camera that only moves in flat way (up-down-left-right) and never rotates. Which means learning how to modify existing cameras in proper way, instead of creating new one. Sadly all wiki tutorials are made with “default settings FTW” philosophy in mind?
Anyone any ideas?