Author Topic: Trigger Help [Solved]  (Read 523 times)

What is %data supposed to be in this function?
Code: [Select]
function FxDTSBrick::createTrigger(%brick, %data)
{
//credits to Space Guy for showing how to create triggers

%t = new Trigger()
{
datablock = %data;
polyhedron = "0 0 0 1 0 0 0 -1 0 0 0 1";
};

missionCleanup.add(%t);

%boxMax = getWords(%brick.getWorldBox(), 3, 5);
%boxMin = getWords(%brick.getWorldBox(), 0, 2);
%boxDiff = vectorSub(%boxMax, %boxMin);
%boxDiff = vectorAdd(%boxDiff, "0 0 0.2");
%t.setScale(%boxDiff);
%posA = %brick.getWorldBoxCenter();
%posB = %t.getWorldBoxCenter();
%posDiff = vectorSub(%posA, %posB);
%posDiff = vectorAdd(%posDiff, "0 0 0.1");
%t.setTransform(%posDiff);

%brick.trigger = %t;
%t.brick = %brick;

return %t;
}
« Last Edit: August 19, 2012, 07:09:03 PM by jes00 »

judging by "datablock = %data;" i'm going to assume it's a datablock for the trigger to mimic

judging by "datablock = %data;" i'm going to assume it's a datablock for the trigger to mimic
But what kind of datablock?

I tried %brick.DataBlock and %brick.getDatablock().

afaik there's only one kind of datablock...

Also, the two things you wrote are the same, one is just a method and the other is a tagged field. You should use .getDataBlock()

Ok I found what I needed to do.

I made a new trigger datablock and used that.

Here is an extremely useful resource I have used in the past.

http://www.davidjsushil.com/tutorials/triggers.pdf