Trigger do not Work with Items
by Alejandro Lopez · in General Discussion · 05/01/2008 (1:44 pm) · 18 replies
Hi all .
i just trying to make a trigger that works with a itemData. i am launching a item using the applyImpulse method , and i want to know when the item enter to the trigger zone.
I think my trigger is correct , because when the player touches the triggers zone, its works ,, but with the item do not triggers.
was going on?
Thanks a lot .
i just trying to make a trigger that works with a itemData. i am launching a item using the applyImpulse method , and i want to know when the item enter to the trigger zone.
I think my trigger is correct , because when the player touches the triggers zone, its works ,, but with the item do not triggers.
was going on?
Thanks a lot .
#2
----------------
Thanks a lot.
05/01/2008 (3:47 pm)
Datablock TriggerData( triggerSapo )
{
tickPeriodMS = 100;
};
function triggerSapo::onEnterTrigger( %this, %trigger, %obj )
{
echo( " triggers !!! ");
Parent::onEnterTrigger( %this, %trigger, %obj );
}
function triggerSapo::onLeaveTrigger( %this, %trigger, %obj )
{
echo( " triggers !!! ");
Parent::onLeaveTrigger( %this, %trigger, %obj );
}
function triggerSapo::onTickTrigger( %this, %trigger )
{
echo( " triggers !!! ");
Parent::onTickTrigger( %this, %trigger );
}
////////////////////////////////////////////////////////////////
and create a item data ::
datablock ItemData( Aro )
{
shapeFile = "~/data/shapes/aros/aro.dts";
mass = 10;
static = false;
};
function Aro::createAro(){
if (! $aroLanzado ){
%aroMontado = $jugador.getMountedObject(0);
$aroLanzado = new Item( h_aroLanzado ) {
position = %aroMontado.getPosition();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "Aro";
collidable = "1";
};
MissionCleanup.add($aroLanzado);
}
}----------------
Thanks a lot.
#3
05/02/2008 (7:02 am)
Any comments will be helful.
#4
05/02/2008 (7:20 am)
First I'd check if triggers work with items... if so I'd then do a check in the onEnterTrigger for the typemask Item like so:if ( %obj.getType() & TypeMasks::ItemObjectType)
{
// do something - then check for specific item here ... or whatever
}
#5
"In versions prior to 1.4, only players and vehicles tripped a trigger. Now items do also"
so , with triggers works with items.
05/02/2008 (8:00 am)
I am following the GameProgrammersGuideToTorque.pdf in the page 338 says :"In versions prior to 1.4, only players and vehicles tripped a trigger. Now items do also"
so , with triggers works with items.
#6
Another thing I'm wondering are you carrying the item, or does it enter the trigger alone? It probably doesn't matter but it might. Also some stuff about triggers in GPGT are incorrect but the author corrected them here.
05/02/2008 (8:53 am)
I thought so, but I wasn't sure so I added that as a disclaimer :)Another thing I'm wondering are you carrying the item, or does it enter the trigger alone? It probably doesn't matter but it might. Also some stuff about triggers in GPGT are incorrect but the author corrected them here.
#7
The goal of the game is enter a ball in a hole, so i am applying a impulse on the item and i put a trigger in the goal zone.
05/02/2008 (9:02 am)
Yes, its enters alone, because the player is launching it , (with applyImpluse method) .The goal of the game is enter a ball in a hole, so i am applying a impulse on the item and i put a trigger in the goal zone.
#8
Try placing the object inside the trigger, and calling a trigger.getNumObjects(), and let's see if it registers.
05/02/2008 (12:57 pm)
Does the ball stay in the hole, or just quickly pass through? Because aside from the Trigger mask not picking up object types (which I can't find any info on editting, and it should accept objects) the only thing I can think of is that the ball is flying through the hole too quickly for the 100ms tickPeriod to register it. Try placing the object inside the trigger, and calling a trigger.getNumObjects(), and let's see if it registers.
#9
When the player is inside , trigger.getNumObjects() = 1 ,,
and when the item is inside ; trigger.getNumObjects(), = 0
so , the triggers cannot dectec a item or what ?
Please any comments will be helful or another solution ?
05/02/2008 (8:23 pm)
Really frustrating. i tried putting manually the item into the trigger zone.When the player is inside , trigger.getNumObjects() = 1 ,,
and when the item is inside ; trigger.getNumObjects(), = 0
so , the triggers cannot dectec a item or what ?
Please any comments will be helful or another solution ?
#10
05/02/2008 (8:28 pm)
Try using another item that comes with tge or tgea... not sure which your using. Try the health item.
#11
i am using like i posted before.
05/07/2008 (12:20 pm)
Mmm, i am not sure about that, anybody can helpme with a example of what kind of items are.i am using like i posted before.
#12
thnks
05/12/2008 (9:01 am)
Any body can give a example of how to throw a ball and detect when its enter to a zone using a trigger.thnks
#13
05/12/2008 (1:01 pm)
Like golf game
#14
There is no form to use a item to launch it and a trigger ?
Beasuse the item works fine , and is very simple to use .
05/16/2008 (9:37 am)
So,There is no form to use a item to launch it and a trigger ?
Beasuse the item works fine , and is very simple to use .
#15
function ShapeBaseData::OnTrigger(%This, %Sender, %TriggerKey, %State)
{
// callback function body
}
edit: or maybe you can create another object (like the hole it goes in, or goal whatever, possibly invisble), and do something when it collides with that object.
05/16/2008 (10:34 am)
I'm gonna look into this I think we might need to use the ShapeBaseData::OnTrigger callback.function ShapeBaseData::OnTrigger(%This, %Sender, %TriggerKey, %State)
{
// callback function body
}
edit: or maybe you can create another object (like the hole it goes in, or goal whatever, possibly invisble), and do something when it collides with that object.
#16
05/16/2008 (4:29 pm)
Yes, , i was thinking to put another object, and use onCollision , but how can i set invisible ? i try with setHidden but , its disable the physic also.
#17
05/17/2008 (6:32 pm)
Is it possible to make a model that is just a collision mesh? I've never tried, but if you could, would that solve the onCollsion problem? I still wanna know why items don't trigger though.
#18
02/18/2009 (9:47 am)
Did anyone ever figure this out? Can items activate a trigger?
Torque 3D Owner Morrock