Triggers and Rotation
by Rubes · in Torque Game Engine · 08/15/2006 (3:09 am) · 11 replies
Okay, this is probably something simple that I'm overlooking, at least I hope.
I would like to place a trigger on the floor just inside a doorway, so when the player enters the room where the trigger is, it will set off a series of events.
So I created the trigger and placed it in the mission just inside the doorway. But, I had to rotate the trigger a little bit so that it lined up nicely with the doorway.
Problem is, I end up with a situation like in the following picture:
Link To Screenshot
The image shows the player's green collision box intersecting with the trigger's yellow world-aligned bounding box, not the trigger's red collision box (which is rotated to align with the doorway). Yet, in this position, the player is setting off the trigger, even though he has yet to enter the doorway.
Is there a way to force collision to occur only with the properly rotated red box?
I would like to place a trigger on the floor just inside a doorway, so when the player enters the room where the trigger is, it will set off a series of events.
So I created the trigger and placed it in the mission just inside the doorway. But, I had to rotate the trigger a little bit so that it lined up nicely with the doorway.
Problem is, I end up with a situation like in the following picture:
Link To Screenshot
The image shows the player's green collision box intersecting with the trigger's yellow world-aligned bounding box, not the trigger's red collision box (which is rotated to align with the doorway). Yet, in this position, the player is setting off the trigger, even though he has yet to enter the doorway.
Is there a way to force collision to occur only with the properly rotated red box?
#2
08/16/2006 (4:42 pm)
So you're seeing the trigger system paying attention only to the trigger's world box and not its object box ?
#3
What is not shown in that picture is a door sitting in the doorway. The red object box is fully inside the room, while the yellow world box extends through the door and into the outside hallway. So in the picture, the player is actually standing outside the door, but is setting off the trigger.
08/16/2006 (4:45 pm)
Yes, that seems to be the case.What is not shown in that picture is a door sitting in the doorway. The red object box is fully inside the room, while the yellow world box extends through the door and into the outside hallway. So in the picture, the player is actually standing outside the door, but is setting off the trigger.
#4
real quick, got to run but:
08/16/2006 (5:04 pm)
Hmm, i'm seeing triggers work as expected, that is, using their object box instead of their worldbox.real quick, got to run but:
new Trigger(debugTrigger1) {
position = "66.7906 -28.1546 -2.52955";
rotation = "0 0 -1 40.2528";
scale = "10 5 2";
dataBlock = "DebugTriggerDB";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};
------------------------
datablock TriggerData( DebugTriggerDB )
{
targetSpawnSphere = "";
};
function DebugTriggerDB::OnEnterTrigger(%this, %trigger, %obj)
{
%obj.setShapeName("entered trigger" SPC %trigger);
}
function DebugTriggerDB::OnLeaveTrigger(%this, %trigger, %obj)
{
%obj.setShapeName("left trigger" SPC %trigger);
}
#5
08/16/2006 (6:01 pm)
Thanks...I'll check that out later and report back...
#6
Are you certain that your trigger is not being set off when the player touches the world box? Otherwise I don't see how or why they would be different.
08/17/2006 (2:38 am)
Well, it looks like your trigger is really not very different from mine. Here's my definition:new Trigger(locutoryTrig) {
position = "40.4261 223.737 176.236";
rotation = "0 0 -1 16.6158";
scale = "1.79592 1.38351 0.696258";
dataBlock = "LocutoryTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};Are you certain that your trigger is not being set off when the player touches the world box? Otherwise I don't see how or why they would be different.
#7
I do remember having some kind of issue like this a loooooong time ago in a old version of TGE, but I'm not sure if it was the same thing, and don't recall having any problem since.
08/17/2006 (6:20 pm)
Is it just a crazy aspect angle on the screenshot, or has your player been rescaled all funky? Maybe the rescaling caused some innacuracies in certain calculations... the margin between the trigger and bounding box in the screenshot is pretty low so it's hard to tell. I don't think it's particularly likely, but you could try using a normal scaled player to see if it's any different. Also remember it's only going to be checking against the players box, so it might not be as accurate as you're looking for.I do remember having some kind of issue like this a loooooong time ago in a old version of TGE, but I'm not sure if it was the same thing, and don't recall having any problem since.
#8
08/17/2006 (6:29 pm)
Yes, the player is scaled a little bit, but not much. I will definitely give it a try with a normal scale, although my experimentation is showing that the trigger is pretty accurately being set off by the scaled player's bounding box. However, there is the possibility that a normal scaled player would be setting off the trigger, so I'll have to try it.
#9
i've deleted the stuff and don't have a screenshot,
but yes, i'm sure.
TGE 1.3.
tip: maybe try testing w/ a trigger w/ a more extreme aspect ratio, eg 5:1
08/17/2006 (6:49 pm)
Hey rubes -i've deleted the stuff and don't have a screenshot,
but yes, i'm sure.
TGE 1.3.
tip: maybe try testing w/ a trigger w/ a more extreme aspect ratio, eg 5:1
#10
08/17/2006 (7:19 pm)
Good idea, I'll give that a try.
#11
Thanks everyone...
08/18/2006 (1:02 am)
Wow, that seems to be it. I had my player scaled at "0.5 0.5 1" and when I put it back to "1 1 1" the problem disappeared. Not sure why that is, but at least it's not an issue anymore.Thanks everyone...
Torque 3D Owner Rubes