Disabling keybind when inside a building
by Jules · in Torque Game Engine · 01/20/2008 (7:59 am) · 10 replies
Hi,
Anyone know of the best way to disable a keybind when in a building? For example.. stop a jetpack from working, or stop going into 3rd person camera.
I have a few ideas, such as using a trigger switch so that the trigger is covering the whole building, but would be interested to find out if you have done this, and how you did it.
Cheers
Julian
Anyone know of the best way to disable a keybind when in a building? For example.. stop a jetpack from working, or stop going into 3rd person camera.
I have a few ideas, such as using a trigger switch so that the trigger is covering the whole building, but would be interested to find out if you have done this, and how you did it.
Cheers
Julian
#2
We wanted to get rid of the roof of each building as you went into it.
Either you cast a ray at the feet of the player, you use a trigger, or if you got your buildings properly zoned - you check what zone the player is. If he's in anything else than the outside zone, he's in a building.
We went with the latter, but I'm sure the others will work too.
01/20/2008 (9:08 am)
We did something similiar.We wanted to get rid of the roof of each building as you went into it.
Either you cast a ray at the feet of the player, you use a trigger, or if you got your buildings properly zoned - you check what zone the player is. If he's in anything else than the outside zone, he's in a building.
We went with the latter, but I'm sure the others will work too.
#3
01/20/2008 (9:35 am)
Thanks Guys. Much appreciated for your input.
#4
01/20/2008 (2:39 pm)
Um, is not the console function isPointInside made for this type of thing?
#5
add into void Player::updateAttachment()
And it DO sorta work, i wanted it to callback InteriorInstance(DIFname) then use DIFname::onDIFCollision() function to set new rules for each DIF that had a name.... but that part isnt working.
Perhaps its something really simple? I'll work on the rest later, and get back to here when i have worked it out. But until then perhaps someone with more knowhow could fix it?
01/20/2008 (3:49 pm)
I was thinking something like this would do it; as a script callback...add into void Player::updateAttachment()
if (gServerContainer.castRay(Point3F(pos.x, pos.y, pos.z + 0.1f),
Point3F(pos.x, pos.y, pos.z - 1.0f ),
InteriorObjectType, &rInfo))
{
//check for interior
if( rInfo.object->getTypeMask() & InteriorObjectType)
{
ShapeBase* col = static_cast<ShapeBase*>(rInfo.object);
Con::executef(col,3,"onDIFCollision",scriptThis(),col->scriptThis());
//Con::printf("onDIFCollision:::::::::: CALLback");
}
}And it DO sorta work, i wanted it to callback InteriorInstance(DIFname) then use DIFname::onDIFCollision() function to set new rules for each DIF that had a name.... but that part isnt working.
Perhaps its something really simple? I'll work on the rest later, and get back to here when i have worked it out. But until then perhaps someone with more knowhow could fix it?
#6
So I am thinking of a modification in player.cc to detect when a player is within a dif interior, then a checking statement function in defaultbind.cs for a keypress, if in interior then don't allow it to be pressed, and if outside interior then allow.
01/20/2008 (4:38 pm)
Looks good, I will be interested to see this working in full ... let me know when you have something and I'll gladly test it out :) $50 for you/ or someone else who can get it working without errors and not via a trigger solution which is how I was going to go about it, and to stop a jetpack based on this resource from working. It also has to work multi-player on dedicated server, and show text in message hud or screen via GUI text to player only (Jetpack de-activated on entering interior) and (Jetpack activated on exiting interior). Resource can then be released freely into the community :) Needs to work with 1.5.2So I am thinking of a modification in player.cc to detect when a player is within a dif interior, then a checking statement function in defaultbind.cs for a keypress, if in interior then don't allow it to be pressed, and if outside interior then allow.
#7
01/20/2008 (8:33 pm)
I have it working for my project now; but being i was out drinking heavy wish to test it fully and will post my solution in the next A.M...
#8
01/20/2008 (8:35 pm)
Caylo.. great! Look forward to your solution :)
#9
01/24/2008 (8:39 am)
Hows your solution coming along Caylo?
#10
01/24/2008 (8:38 pm)
Oh ya.. I have been swamped. I have some contracts to finish before getting back to personal projects... Will try and dump what i have so far here, 'night or next morning, should be enough to set you in the right direction.
Torque Owner Tim Heldna