Author Topic: Torque Typemask List  (Read 4789 times)

if(%physicalzone.iswater)
{
   //foobles
}

getting the ID of zones and calling .dump() can yield may interesting things
It's not working with bricks.
Code: [Select]
function Player::lookingAtWater(%player, %range)
{
%client = %player.client;

if(!isObject(%player) || (!isObject(%client)))
{
return 0;
}

%typemasks = $TypeMasks::WaterObjectType | $TypeMasks::PhysicalZoneObjectType;
%start = %player.getEyePoint();
%beam = vectorScale(%player.getEyeVector(), %range * 0.5);
%end = vectorAdd(%start, %beam);
%target = containerRayCast(%start, %end, %typemasks, %player);
%obj = firstWord(%target);

if(%obj.physicalZone.isWater)
{
return 1;
}

return isObject(%obj);
}

Code: [Select]
%typemasks = $TypeMasks::WaterObjectType | $TypeMasks::PhysicalZoneObjectType;

...

if(%obj.physicalZone.isWater)

The raycast is hitting the physical zone, not the brick. Refer to %obj.isWater instead of %obj.physicalZone.isWater.

The raycast is hitting the physical zone, not the brick. Refer to %obj.isWater instead of %obj.physicalZone.isWater.
Still not working : /

It's not working with bricks.

You don't use it with bricks, you use it with physical zones, which are independent from bricks.

You don't use it with bricks, you use it with physical zones, which are independent from bricks.
Then whats the point of what I just did? I can already detect map water but I need to detect brick water also.

Then whats the point of what I just did? I can already detect map water but I need to detect brick water also.

brick water consists of two parts
1. A brick
2. A physical zone with the same dimensions and position as that brick, which is basically identical to map water except smaller
You can have physical zones without bricks too (such as map water or maps with low gravity)

try having it echo the id of whatever object the raycast hits, then doing .dump(); or .getclassname(); on it to see if it is getting the object you are looking for.

brick water consists of two parts
1. A brick
2. A physical zone with the same dimensions and position as that brick, which is basically identical to map water except smaller
You can have physical zones without bricks too (such as map water or maps with low gravity)

try having it echo the id of whatever object the raycast hits, then doing .dump(); or .getclassname(); on it to see if it is getting the object you are looking for.
Ok I got it to detect map water and brick water but now the only problem is that because map water is throughout the entire terrain the raycast will go through the terrain and hit the map water.

Ok I got it to detect map water and brick water but now the only problem is that because map water is throughout the entire terrain the raycast will go through the terrain and hit the map water.
then you might as well just do terrain and brick masks as well and do a getType check

%obj.getType() & $TypeMasks::WaterObjectType || %obj.getType() & $TypeMasks::PhysicalZoneObjectType i believe

And then it becomes redundant to search for physical zones when you're searching for bricks. However, a map maker might use physical zones, so I'd leave it.