Making new wave after throwing a thing in to water

Hi, again me, I have another problem, your “getChild()” doesn’t exist :smiley:
So I write this:
map = assetManager.loadModel(“Scenes/water_surface.j3o”);
vertices = ((Geometry) this.map.getUserData(“Plane/Plane1”)).getMesh().getBuffer(VertexBuffer.Type.Position);

Ok, I added “Plane1” but it told me, that there is nothing “java.lang.NullPointerException”

Where is the problem?
I’m getting mad :smiley:

From what I can tell you have to cast it to a node to get access to the getChild method

Easy :smile:

this.scene = (Node) am.loadModel(“cave_level/cave2.j3o”);
could u please try to load it this way, I did not notice that you use the spatial my bad

Thx, but now there is a problem in a Math @Ecco Can you help me?

java.lang.ArrayIndexOutOfBoundsException: 102
float n = waveMap[currmap][countX - 1][countY] + waveMap[currmap][countX + 1][countY] + waveMap[currmap][countX][countY - 1] + waveMap[currmap][countX][countY + 1];

Loafing a scene is ok now, just there is a problem in a Math “ArrayIndexOutOfBoundsException” :confused:

…well…i mentioned before that you have to properly set values for number of tiles and corresponding vertices you have in square sized water surface…there is no issues with math, you just need to pass proper data values … your array is out of range…

…whole idea is set around water surface plane, created in some 3D modeling tool of choice…such surface could be created in runtime, but this example assume that surface is already created/loaded…other important thing to understand is value of waveMap, which in given example assumes that Y position of plane aligned on to X-Z plane is 0.0f …in case your water surface is aligned somewhere else, then you need to apply that offset on to resulting n value, otherwise it will not look correct…take a look at given image…this should explain everything…

1 Like

So My problem is, that my 3D model is so small, that I can’t have big value in numVertsX and numVertsY?
@Ecco
(thanks for image, explain a lot)

Ok, I have probably last problem, shouldn’t be in “vertices” some values? Because by debuger there are more likely none :smiley:
Can I as where is the problem? Because when he was getChild(), he didn’t have any problem.