Author Topic: Refilling a Brick  (Read 2140 times)

Ya, its returning a 1 in .plant(), so it has some overlap error. What should I change around to fix it? Are the relative positions going to be some exact number like 3.001345, or will they be integers? And does rotation cause collision problems?

Ya, its returning a 1 in .plant(), so it has some overlap error. What should I change around to fix it? Are the relative positions going to be some exact number like 3.001345, or will they be integers? And does rotation cause collision problems?
They will be a decimal, but nothing that bad.
The position is the very center of the brick. A plate is 0.2 in height, and a stud is 0.5 in length.

A plate is 0.2 in height, and a stud is 0.5 in length.
I thought those were half that?

They will be a decimal, but nothing that bad.
The position is the very center of the brick. A plate is 0.2 in height, and a stud is 0.5 in length.
Oh, alright, but I should have their positions perfect then if it's not some crazy decimal. I tested their positions in-game, and it works out fine, they just have a weird overlapping problem and won't plant. What do I need to change to my current script? If you test out just the "for" statements, they all place fine in the right positions.

Oh, alright, but I should have their positions perfect then if it's not some crazy decimal. I tested their positions in-game, and it works out fine, they just have a weird overlapping problem and won't plant. What do I need to change to my current script? If you test out just the "for" statements, they all place fine in the right positions.
The rendering will lock them to the closest spot on the grid, but will leave it's physical object in the wrong spot.
You'd have to do some kind of math to get them into the right spots.

Bricks = units * 2
1 unit = 2 bricks


Also try some nested X-Y-Z loops.

Bricks = units * 2
1 unit = 2 bricks


Also try some nested X-Y-Z loops.
Incorrect. You're forgetting about the Z-axis.

I explained it to you.

I explained it to you.
What? You just told me Nixill had done this. You told me his method, not how to do it. You just said, "He calculated every space for the brick then placed the bricks" or something similar. Sadly, that does not help me.

Also, I went in-game and placed a 16x Cube, set a global variable to its position ($PosA), then I set all its properties to disappear, then placed my tempbrick (4x Cube) at a corner and set its position to a global variable ($PosB). Then I typed:
Code: [Select]
%A = vectorSub($PosA,$PosB);
echo(%A);
And it echoed "3 3 3", then one whole 4x Cube to its side it printed "1 3 3", and it does this in all ways. It highest and lowest values are 3 and -3, going by 2's across. So, I don't see what's wrong with my positions in my code then.

Incorrect. You're forgetting about the Z-axis.
"Also try some nested X-Y-Z loops."

Wasn't related the the statement about units to bricks.

Alright, I changed to 8x Cubes. I removed the angleId, rotation, and scale fields, as I think they're set by default. Updated code on original post. I'm not sure what I need to change to not cause the overlap error. Any help please?
« Last Edit: October 17, 2009, 02:23:28 PM by lilboarder32 »

Help? Why are there overlap errors?

The brick you're trying to refill still "exists", even though you deleted it. Schedule the part after the .delete() for 0 ms later and you'll be fine.

EDIT: Actually, just did a test: You don't even need to schedule it, just call it as a seperate function.
« Last Edit: October 18, 2009, 11:38:59 AM by Truce »

The brick you're trying to refill still "exists", even though you deleted it. Schedule the part after the .delete() for 0 ms later and you'll be fine.

EDIT: Actually, just did a test: You don't even need to schedule it, just call it as a seperate function.
Oh wow, thanks. Call the delete as a seperate function? Or call %this.delete() then the rest as a seperate function?

Oh wow, thanks. Call the delete as a seperate function? Or call %this.delete() then the rest as a seperate function?

Code: [Select]
function fxDTSBrick::refill(%this)
{
     ...
     %this.delete();
     refill_B(%any,%args,%you,%need,%to,%pass,%on);
}

function refill_B(%any,%args,%you,%need,%to,%pass,%on)
{
     ...
}