I have been trying in vain for several hours to get JME to run successfully within an Eclipse view. I have tried various solutions such as using the swt-jme code posted by The Librarian and source from the MW3D code base. I did eventually get something into a view but several problems then occurred, either with the Input System or trying to run my plugin integrated into a standalone RCP application. Ideally I would like to use the JMEView class from MW3D. As mentioned, I did get this working but then could not get the input to work properly (FirstPersonHandler through an exception stating that the Display had not been created although I was staring right at it…). Using the code from The Librarian also worked up until I tried to deploy the application, at which point I got classpath issues with the META-INF/services directory. I feel I have now exhausted my options and am seeking some sage advice.
I would consider myself a proficient RCP developer and know my way around plug-in deployment, the usual classpath gotchas etc. but this really has me stumped. I would be extremely grateful if anyone could help me to get through the following scenario with the least amount of fuss, the second point outlining the area I require assistance with:
Create an Eclipse RCP application with a view (taken care of)
Integrate code to allow me to use JME within the view (help please)
Package the app up and deploy as an RCP application (I can do this but have been hitting some classpath issues)
input = new FirstPersonHandler( component.getCamera(), 1,
1 );
This can be called after the construction of the SWTCompositeGame, this is the first peice that you have to make in order to get the input system created. Of course now that you have a reference to that input handler created, then you have to update it.
In the update method put ( input.update( tpf ) ), and this will update the input. The mouse didn't work unless I call MouseInput.update() in the update method as well.
I believe that you have used the jme-mw3d plug-in to start, which is the what you need to get your application up and running with out the depencies on the MonkeyWorld3D plug-in, which means only include jme-mw3d to build you application. Just check it out, create a new RCP application, create a view which extend the JMEView, and you are done.
Thanks very much for the speedy reply. I knew that there was something I'd have to do to get the input working for me as it wasn't created by default - just didn't know what I'll give that a go forthwith along with your other suggestion about the jme-mw3d plugin which was kind of what I was trying to do originally. Thanks again for the advice.
I am happy to report success after following your advice The following is what I came up with in a JMEView subclass, adding a single Box node for testing:
I take it this is what you had in mind? I notice that the SWTCompsiteGame class already has an 'input' instance variable so wasn't completely sure about creating my own in the View.
The only thing is that the 'W' and 'S' keys appear to perform the reverse function from normal (i.e. 'W' moves out and 'S' moves in). Can't have everything I suppose....
Glad that I have helped with it, yes you can use the input supplied from the base class, but you have to intialize it as you have done, I just seen it :D.
I take it this is what you had in mind?
Yes.
The only thing is that the 'W' and 'S' keys appear to perform the reverse function from normal (i.e. 'W' moves out and 'S' moves in). Can't have everything I suppose....
May be its a camera issue, I will have to check for that.
I tried to use the mw3d library in an Eclipse plugin and use the code snippet you provided above. Unfortunately, using jME 1.0 and Eclipse 3.4, I get the following stack trace when trying to open the view: