Game Development Community

FxShapeReplicator without terrain

by James Laker (BurNinG) · in Torque Game Engine · 04/04/2006 (2:58 am) · 3 replies

I need/want to use the fxShapReplicator for my 2D space game...
atm the fxShapReplicator wants to put my asteroids on something:
// Check that we can position somewhere!
    if (!(  mFieldData.mAllowOnTerrain ||
            mFieldData.mAllowOnInteriors ||
            mFieldData.mAllowStatics ||
            mFieldData.mAllowOnWater))
    {
        // Problem ...
        Con::warnf(ConsoleLogEntry::General, "[%s] - Could not place object, All alloweds are off!", getName());

        // Return here.
        return;
    }

Now there are some other areas that use these restrictions:

// Check Illegal Placements.
                if (((CollisionType & TerrainObjectType) && !mFieldData.mAllowOnTerrain)    ||
                    ((CollisionType & InteriorObjectType) && !mFieldData.mAllowOnInteriors) ||
                    ((CollisionType & StaticTSObjectType) && !mFieldData.mAllowStatics) ||
                    ((CollisionType & WaterObjectType) && !mFieldData.mAllowOnWater) ) continue;

I can't seem to figure out how to add the it in space... though...
Anyone have an idea... or even better... Code that will fix this problem?

#1
04/04/2006 (3:40 am)
Unless someone recently changed how the replicator works, then it is shooting a ray down to find a position to place the object.

It takes a random x,y + the z from the raycast.

In space, there is nothing like a terrain, interior, staticTS or water (the 4 collision checks it uses).

So just remove all the checks+raycast and pick a random z position. Then check if there is anything close to that position that you collide with (e.g. do a radius search for other asterioids).

And that should be it.

All this could just as easily be done in script BTW.
#2
04/04/2006 (5:17 am)
Looking through the code now... It's actually quite simple...
I'll post a resource when I'm done.

So far I have 3 extra fields (minSpaceHeight, maxSpaceHeight, allowinSpace)
Will add another one to place it on a single plane later.

Back to paying job for now...
#3
04/04/2006 (11:49 pm)
[EDIT] Removed... Search for my resource