Author Topic: Get bricks next to bricks [Solved]  (Read 578 times)

This issue that I believe some of you have stumbled upon is about getting bricks that is in contact to other bricks. The problem is not to get the actual brick, but do it in such a fashionable way on the fly.

To get a brick above or under a brick, you would easily do so by using one of the following methods:
Code: (fxDTSBrick) [Select]
getDownBrick
getUpBrick
This will work flawlessly. Now, when it comes to getting bricks at the sides, there is currently no included functionality to do so, but can still be done by using one of these function pairs combined with the brick position and dimensions:
Code: [Select]
containerFindFirst / containerFindNext
initContainerBoxSearch / containerSearchNext
initClientBrickSearch / ClientBrickSearchNext
The last pair is only used locally on the client.

Even if these methods mentioned above works really great, the container has a flaw: It wont count in bricks that have their ray-casting off(Client version excluded). This is quite a big problem in my case, as I am in need to get all bricks, with or without ray-casting.
Badspot have implemented four events (fireRelayNorth/East/West/South) which all somehow works, even if ray-casting is disabled. Due to this, I suspect that he is using an internal system that negates ray-casting, or he knows some functionality we don't know. I wish for the latter.

A last resort could end up in looking through all bricks, or even better, a hash of closest brick clusters(Why not make a octree?), make some calculations and find the bricks that is next to the brick that is checked. It is however slow and wont be optimized for TorqueScript.

Even though, if anyone knows a solution of above problem, please enlighten me in that information.
« Last Edit: January 26, 2013, 07:00:38 PM by mctwist »

Why not shoot a raycast?

As I wrote in my previous post, that is not possible on bricks with no ray-cast at all.

..... $TypeMasks::FxBrickAlwaysObjectType ???

I believe that is the answer on my question. I think it slipped my mind. Sometimes the easiest bugs are the hardest to find.