Problem with FixedLogicRateGame

you need the "ZbufferState" to be applied to the rootNode



like this:




// attach your terrain here...

ZBufferState zEnabled = display.getRenderer().createZBufferState();
zEnabled.setEnabled(true);


// all of below is essential

rootNode.setRenderState(zEnabled);

rootNode.updateGeometricState(0.0f, true);
rootNode.updateRenderState();



Make sure your calling the updateGeometricState(...) and updateRenderState() at the end of initGame also.

Thats all of the advice I can give you without looking at teh code for your TerrainManager.

DP

wow … thanks alot :slight_smile: i guess the problem is finally solved :wink:



time for the next one :wink:

Your very welcome.



I think what the next problem is going to be :wink:



coughplayer-terrain collision detectioncough



DP

I’ll quickly respond to this before the thread dies…

"DarkProphet" wrote:
Perhaps you could set the interpolation of the update method to 1/TicksPerSecond instead of me having to have a variable set for the number of ticks and doing it manually.
That would sort of defeat the point. I would like it to be clear that there is no interpolation value, nor is one needed. Its inclusion may confuse some people, I'm afraid.
"DarkProphet" wrote:
Oh yeah, could you perhaps explain the interpolation value of the rendering method please? I dont seem to understand it very well...
The interpolation value for the render(float) method specifies, as a percentage, how far between ticks the current rendering is. So, a value of 0.5 would mean that rendering is occuring at a time that is halfway between two logic ticks.

Interpolation is used to avoid rendering the same thing multiple times. For example, if render(float) was called three times between update(float), it may be drawing the exact same thing every time as the objects' positions haven't changed. However, with interpolation, we can draw objects at a position part way between one tick and the next.
"DarkProphet" wrote:
*cough*player-terrain collision detection*cough*

sounds like a common problem ;)

but as i'm going to (try to) make some kind of rts i'll just be setting the height of the objects ;)

ok ... and set the rotation to have it look right on the terrain ... (which is actually the problem ;) ... but it is supposed to work ... have to recheck some things tomorrow) ...

btw ... i think it's a little bit confusing that jME sets the z axis as depth ... but i guess i should get used to it, shouldnt i ? ;)

u can change the axis to whatever you like:



Vector3f location = new Vector3f(0, 0, 0);
Vector3f left = new Vector3f(-1, 0, 0);
Vector3f up = new Vector3f(0, 0, -1);
Vector3f dir = new Vector3f(0, 1, 0);

cam.setFrame(location, left, up, dir);



The above code sets the Z axis as above, the Y Axis becomes the depth and the x axis is right. Just like in 3D Studio Max....

DP

sure … but this doesn’t affect other objects … i’d had to rotate everything by 90° … or … ( little light blinks up over my head ) found smiley … i just have to rotate the rootNode if everything else would be attached to it right?

yeah you could just rotate the rootNode, but why would you want to do that anyway?



DP

correct me if i’m wrong but doesn’t TerrainPage aligns the terrain in xz dimension? or is there a way to change this? (without rotating the terrain)

x is left, z is forward. And y is the up and down. So the terrain varies along the y axis (up). Thats the natural way to do it, isn’t?



DP

actually no … at least before jME i haven’t seen one 3d system which was aligned this way … (expect from math classes … where i have some problems with it :wink: )

The decision is based on RenderWare and NetImmerse. While it may seem strange, there is a reason behind it believe it or not. Because you can now define your camera axis as: (1, 0, 0), (0, 1, 0) (0, 0, 1) (left, up, direction). You have an identity matrix.



[1 0 0]

[0 1 0]

[0 0 1]



Thus, we now can have a camera node, that behaves like everything else.

:slight_smile: aha … so … i have no problem with it … will get used to it :slight_smile:



(let me guess … the sentence above contains at least 3-4 grammatical errors :wink: )

na, ur english is fine :). Its better than i’s :wink:



DP

hihi :slight_smile:



ok … before this thread gets to ‘spammy’ i’ll just shut up and get coding :wink: