The BasicGame project customize

Hello, let me start of by saying thanks for a great tool and a great engine!

It’s by far the best I’ve tried.

Now, I’ve been doing some examples, working with my project by using the examples and got stuff working nicely, doing models in Blender, exporting and importing into my project, works nearly perfect :slight_smile:

There is however a few things right now that I am stuck with. Basically, at this point two things stop me from moving forward as I’d like. And let’s see if I can get some pointers.

I suspect the one problem considering Camera is related to the BasicGame class, I do not wish to use FlyCam, since I am doing a 3rd person “diablo view” with about 45 degree cam, locked on player in center of screen with rotation possible but I don’t want jaw (is that the correct english term? No going down towards the ground or up above looking straight down?). Anyway, I’ve found the Camera class and been configuring it with the correct position, direction and such, but I am lost as to how I activate it and disable the FlyCam?

I have a basic inputhandler to later take care of the movement of the camera already.

My second problem is concerning lighting and shadows, I would prefer to have an even light from all directions, with one “stronger” light from a set point so that objects cast shadows but arent completly dark on the oposite? I tried adding a DirectionalLight, but I can’t manage to tone it down, it’s very bright and makes my modells shine alot, they do not cast shadows either, I been trying to set shadow properties using a function I can’t name on top of my head, I know I can assign None, Cast, Recieve or CastAndRecieve as options to it ? I tried CastAndRecieve on all modells I loaded, but no shadows. I must be missing something.

Regarding lightning I suppose I need to make use of the Material class, but I have no material to load, can I use some template from jME or do I need a Mat-file? If so can Blender make them?

Well that was a longer post then I expected, sorry. Thanks again for a great tool!


i suppose that by BasicGame you mean SimpleApplication?

first to disable the flyCam you need to call flyCam.setEnabled(false); in your simpleInitApp method (for example)

the “real” camera in SimpleApplication is the attribute named “cam”. You can wrap this cam with your home brewed camera (look at the FlyByCamera class to know how it’s done)

For shadows, the shadowMode (None, Cast, Recieve or CastAndRecieve ) is a hint for the shadow processor to know which objects cast shadows and which are not.

But in order to render shadows you need to add such processor to your viewport like this.

PSSMShadowRenderer shadowRenderer = new PSSMShadowRenderer(assetManager, 1024,4);



put this code snippet in your simpleInitApp and shadows will show up.

the 1024 parameter in the constructor is the size of the shadows maps (must be a power of two). The wider the map, the better the quality, but the more memory you’ll use.

The “4” parameter is the number of splits (numbers of maps). The more split you have the better the quality but the slower will be the application

You can play with shadow intensity with the setShadowIntensity method on the processor. 0 is transparent shadow 1 is complete black shadow (default is 0.7)

I have to write a wiki how to for shadows…it’s in my todo list :stuck_out_tongue:

For material i suggest you read the wiki page

Hope that helps

EDIT : I moved the topic to Troubleshooting - General since it was not related to JMP


Let me respond to your camera problem. You can simply disable flyCam with: flyCam.setEnabled(false);. For your special camera, I suggest you take a look at ChaseCamera class to see how its done and modify it according to your needs.

I cannot really tell you anything useful regarding shadows (because I haven’t used that feature yet).

I can only tell you smth about lights and materials, so: even light from all directions is DirectionalLight, as you already know. You can set its color to gray or dark gray for example, to tone it down. You can also set its direction so that it looks like its shining from some far point (like sun).

You should use material which takes in consideration lights:Material mat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);.

Hopefully it helps. :slight_smile:

EDIT: Sucks when you answer on a post that has been answered while writing an answer yay. :slight_smile:

Hehe thanks both of you. I posted in JMP section due to me thinging this had to do with SimpleApplication which I misstook for BasicGame (which is default name for the project lol) and it’s possible limitations (or my lack of knowledge for features).

I did do : flyCam.setEnabled(false); But I am pretty sure all that did was disable the movement of the camera?

Or does this actually make the app. use the “cam” class instead of flyCam? Now that I think about it if cam and FlyCam both start at 0,0,0 I wouldn’t be able to tell the differance lol.

I am new to 3d and modeling so I am a bit confused about the whole material/texture thing, I used to think of “material” as textures, that’s how I thought it worked. But thanks, I will try to play around with it some using the “Common/MatDefs” materials then as I understand materials can be applied to any surface regardless of the texture I later use?

Setting flyCam.setEnabled(false); only disables this flyCam controller. Application always uses cam, flyCam is only an abstraction for modifying “cam” position and rotation based on input from mouse and keyboard.

Yes, materials actually “MUST” be applied to the geometry (any surface) which you add to your scene (or else you won’t see anything :)).

Okay thanks, I understand now.

However, I do not use any Material as far as I know. Here’s the part of my code where I load an model from Blender, using OgreXML exporter, converting to jME binary in JMP, then load as below

Spatial obj = assetManager.loadModel(“Models/” + object);

obj.setLocalTranslation(x, y, z);


hmm… I just noticed there’s a .material file exported with some little info in it, so I suppose that’s it :slight_smile:

I’ll read up on Materials more. Thanks again for clearing this up.