Hi,
I started yesterday with JME3. I had experiences with JOGL and was always using your math libs in my projects. But otherwise JME was completly new to me.
I think that you have done a very nice job and it is a pleasure to work with JME3. I coded one night and have already an application where an animated model is rendered and when i click onto it with the mouse the animation is changed. There is also a nice sky map with sphere mapping. I searched a lot on the forum and in the wiki to get this done and it was mostly easy and quickly done.
But I have a few inputs and questions. I don't know if my inputs they help you, as I am realy new to JME and have not understood it completly by now.
- Sometimes there is lots of documentation missing. For example the class CollisionResults (I think this is why JME3 is in the alpha state, but if there were some examples in the JavaDoc I would have done the application in maybe half of the time).
- I would like to see a feature like an onKeyPress event for keyboard inputs. The key binding event is fired again and again and again while the key is hold down.
- I could not figure if there is a better way to get the absolute mouse coordinates in a window. This is what I am currently doing:
(The constructor is added for the next question.)
public class Input implements RawInputListener {
private Main main;
private InputManager inputManager;
private Camera camera;
Input(Main main, InputManager inputManager, Camera camera) {
this.main = main;
this.inputManager = ......
inputManager.addRawInputListener(this);
}
....
public void onMouseButtonEvent(MouseButtonEvent evt) {
//left mouse button pressed?
if(evt.isPressed() && evt.getButtonIndex() == 0) {
Vector2f screenPos = new Vector2f(Mouse.getX(), Mouse.getY());
....
}
The problem is, that Mouse depends on import org.lwjgl.input.Mouse;. I don't think this is the right way to do this.
[/list]
- I am still thinking of a good software architecture for my application. I want to code an application where some models are rendered and when I click on them I can give them orders where they should move (like in an RTS Game). I have currently one main class, which holds references to an input class, a model class and a sky class. To use my input class I have to parameterize it with an reference to the main class so that I am able to react to inputs and an instance of the inputManager (look at the constructor above).
I don't think that I am currently doing this in the best way there is. If anyone can drop me a hint I would be glad. Nice would be some kind of service oriented approach (may be a bit overhead), or just an static variable Main.inputManager, that could be acccessed from everywhere. Some example architectures for different applications or just some design patterns that have proven helpful while working with JME would be useful.
- As I already said I am currently rendering a model. This is currently done this way:
Model(Node rootNode, AssetManager assetManager) {
Spatial model = (Spatial) assetManager.loadModel("Models/Oto/Oto.meshxml");
model.setName("PlayerChar");
model.center();
AnimControl control = model.getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
channel.setAnim("stand");
rootNode.attachChild(model);
}
What is bothering me, is that I want this model standing an plane (later terrain) that is drawn along the x- and z-axis. How can I figure out how much I need to translocate the model so that its feet are on the plane.
[/li]
void checkMouseClickCollision(Ray ray) {
CollisionResults collisionResults = new CollisionResults();
rootNode.collideWith(ray, collisionResults);
if(collisionResults.getClosestCollision() != null &&
collisionResults.getClosestCollision().getGeometry() != null &&
collisionResults.getClosestCollision().getGeometry().getParent() != null &&
collisionResults.getClosestCollision().getGeometry().getParent().getName() == "PlayerChar") {
model.nextAnimation();
}
}
[/li]
Thanks for all your work on this awesome engine. I'd like to learn JME, as I every time I started an 3D project I had to do the same boring stuff again and again (for example shadow volumes or just a little helper class that loads shaders).
Greetings,
iuiz
(PS: Your forum has problems with code tags within li tags....)