std::cout << "Hello, World!" << endl;
I have a question that i have been trying to figure out for the past couple of days and was wondering if someone on here could possible help me.
I have been trying to place grass on my terrain randomly. I can randomize the x and the z values of the object, but when i assign it to the terrain height it keeps the first value of the first object and all the other 99 objects are at the same height, so all the grass is floating or under the terrain.
Also I have sparkys collision lib, but i cannot figure out how to get the height of an actual terrain.x object. So for now I am using the integrated gdk terrain commands.
Here is my code!!
void AddGrass()
{
dbLoadObject("Models/grass.x",grass);
dbLoadImage("Models/grass4.dds",grass);
for(int i = 99; i < 200; i++)
{
dbTextureObject(i,grass);
dbSetObjectTransparency(i,6);
dbInstanceObject(i,grass);
dbScaleObject(i,50,50,50);
float gh = dbGetTerrainGroundHeight(Terrain,dbObjectPositionX(i),dbObjectPositionZ(i));
dbPositionObject(i,dbRND(4000),gh,dbRND(4000));
}
}
[img]null[/img]