Hello, I'm trying to figure out how I can place a block on another block in all directions.
If I have my crosshair on the right side of a block, I want another block placed next to it on the right side,
if I have my crosshair on the top of a block, I want another block placed on top of it etc.
What my code looks like now:
int SelectedObject = dbPickObject(dbScreenWidth() / 2, dbScreenHeight() / 2, 0, 10000);
if(dbMouseClick() == 2 && PlaceDelay <= 0)
{
if(dbGetPickDistance() < 250)
{
dbMakeObjectBox(BlockID, 48, 48, 48);
dbPositionObject(BlockID, dbObjectPositionX(SelectedObject), dbObjectPositionY(SelectedObject)+48, dbObjectPositionZ(SelectedObject));
dbTextureObject(BlockID, 1);
dbScaleObjectTexture(BlockID, 3, 3);
SC_SetupComplexObject(BlockID, 1, BlockID);
BlockID += 1;
PlaceDelay = 20;
}
}
All this does is placing a block on top of another block, doesn't matter which side of the block I'm looking at.
I started with 3D programming today, so if you think my code looks bad it would be great if you could tell me how to improve it.
It might not be enough code to help me, but well, the main problem is the placing of blocks :p
If you don't understand or need any more info, just ask
Thanks.