Conversation started Jun 25, 2018 at 8:58.
Jun 25, 2018 08:58
hi
Am I alone here :(
Why code when you can code()
@genaray Yes. The + signs in the bottom line are misplaced
Jun 25, 2018 09:24
@KevinvanderVelden hi
@doppelgreener hi
how are you all
Can someone help me with generating terrains with negative positions
user92578
once again, ask, dont ask to ask
I have a terrain and I need to support terrains with negative positions colliding with the player
You're not going to get someone going "yes! i will help with that" before they know what the problem even looks like, so asking if someone will help is kind of a waste of time. Just post the question and if someone can respond to it helpfully they may do so.
user92578
Jun 25, 2018 09:38
And why do negative heights currently not work?
no negative positions don't work not heights
user92578
okay lol
so If I set the whole terrain to a negative coordinate the player-terrain collision will just return 0
user92578
first of all, what is a negative position?
Where the terrain is positioned in the world
I repersent that as a vector
If one of the values are negative than the collision returns 0
Jun 25, 2018 09:48
you don't need help generating terrain with negative values then, your collision code is messed up instead
@doppelgreener I'll show it here:
You really need to debug and unit test this stuff.
public float getTerrainHeight(float worldX,float worldZ) {
		float terrainX = worldX - this.x;
		float terrainZ = worldZ - this.z;
		if(this.x > worldX) {
			terrainX = this.x - worldX;
		}
		if(this.z > worldZ) {
			terrainZ = this.z - worldZ;
		}

		float gridSize = SIZE / ((float) heights.length -1);
		int gridX = (int) floor(terrainX / gridSize);
		int gridZ = (int) floor(terrainZ / gridSize);

		if(gridX >= heights.length - 1 || gridZ >= heights.length - 1 || gridX <= 0 || gridZ <= 0) {
			return 0;
Dude, debug your stuff.
Set a breakpoint and start debugging.
Have you debugged it?
You should be coming to us only after you've debugged it and are still not sure.
yes I have and I am sure that the code is ok
user92578
Jun 25, 2018 09:53
well then there must be no issue!
Is it getting input that looks correct, doing the right things to it, and providing the right output? Because if your code isn't working the way you expect, then one of those things is wrong.
well the output of the program says otherwise
If there is no bug in this code, then there are bugs elsewhere, such as the collision detection code that uses this output.
@doppelgreener I have looked and changed stuff and I'm sure that the terrain generation code is the problem
user92578
okay fuck this i dont have the patience for this right now
Jun 25, 2018 09:55
@TheMaskedRebel Then you haven't debugged properly.
I'm going get some concrete information
I need to make this really clear: we are not, and cannot be, a debugging service. Like, we cannot be in that we do not have the resources to debug (we don't even have your game files -- and we're not going to download those to go through it). You need to do the debugging yourself.
This may mean also learning how to debug effectively.
But it is very clear you have not debugged, because you cannot have a bug and also be sure your code is fine. Somewhere it's broken, and you need to set breakpoints and step through and examine the code to find where.
I think I know where the problem is.
Good, set breakpoints and/or make changes to find that out.
The code I'm using doesn't seem to allow the generation of negative terrains
 
Conversation ended Jun 25, 2018 at 9:57.