Author Topic: Trigger positioning help  (Read 367 times)

I have this code here
Code: [Select]
function fxDTSBrick::handleBrickPlant(%brick, %data)
{
if(!isObject(%brick.trigger))
{
%datablock = %brick.getDatablock();

%trigX = getWord(%datablock.triggerSize, 0);
%trigY = getWord(%datablock.triggerSize, 1);
%trigZ = getWord(%datablock.triggerSize, 2);

if(mFloor(getWord(%brick.rotation, 3)) == 90)
%scale = (%trigY / 2) SPC (%trigX / 2) SPC (%trigZ / 2);
else
%scale = (%trigX / 2) SPC (%trigY / 2) SPC (%trigZ / 2);


%brick.trigger = new trigger()
{
datablock = %datablock.triggerDatablock;
position = getWords(%brick.getWorldBoxCenter(), 0, 1) SPC getWord(%brick.getWorldBoxCenter(), 2) + ((getWord(%datablock.triggerSize, 2) / 4) + (%datablock.brickSizeZ * 0.1));
rotation = "1 0 0 0";
scale = %scale;
polyhedron = "-0.5 -0.5 -0.5 1 0 0 0 1 0 0 0 1";
parent = %brick;
};

%boxSize = getWord(%scale, 0) / 2.5 SPC getWord(%scale, 1) / 2.5 SPC getWord(%scale, 2) / 2.5;

initContainerBoxSearch(%brick.trigger.getWorldBoxCenter(), %boxSize, $typeMasks::playerObjectType);

while(isObject(%player = containerSearchNext()))
%brick.trigger.getDatablock().onEnterTrigger(%brick.trigger, %player);
}
}
}
What this code does is it places the bottom of the trigger at the top of the brick.
How do I get it so it places the bottom of the trigger at the bottom of the brick?
« Last Edit: November 06, 2011, 03:24:47 PM by Jasa1 »

I used to have an event I put together that did this, but Trader got it failed for extending outside the brick. He told me to put it inside a brick, but then you couldn't build there. I gave up, left the game for a while, and came back. "ZoneBricks!" loving ripoff of what Trader told me to do...

Sorry, got a bit off track... Just pisses me off, but my point is that if I can find my code, I can help you. Want it?

I used to have an event I put together that did this, but Trader got it failed for extending outside the brick. He told me to put it inside a brick, but then you couldn't build there. I gave up, left the game for a while, and came back. "ZoneBricks!" loving ripoff of what Trader told me to do...

Sorry, got a bit off track... Just pisses me off, but my point is that if I can find my code, I can help you. Want it?
Sure

I really need to use my brain more.
It took my an hour and all I had to do was change + (%datablock.brickSizeZ * 0.1)); to - (%datablock.brickSizeZ * 0.1));