Author Topic: [CODING] How to create and properly handle ghost bricks + movement?  (Read 675 times)

I'm fulfilling this mod request, and currently i'm figuring out how to make a ghost brick preview. I'm already looking through the new duplicator code to figure out how it works (i didn't look at duplorcator since that one seems to be buggy for big dups), but would like any information you guys may have on this.

I'm not sure how to even access the ghost brick's %obj.dump since it doesn't respond to raycast searches.

If i figure out the answer to my own question before an answer is provided, i'll answer it and lock the topic if i have nothing else to ask. Though i'll probably have more questions later...
« Last Edit: February 12, 2016, 04:30:30 AM by Conan »

You just have to do something like this:

%ghost = new FxDTSBrick()
{
    datablock = %data;
    position = %pos;
    rotation = %rot;
};


And to move it:

%ghost.setTransform(%pos SPC %rot)


For some reason the rotation field uses degrees and setTransform uses radians. To get the first rotation: https://github.com/Zeblote/Tool_NewDuplicator/blob/master/classes/server/selection.cs#L1169-#L1175

And to get the second roation: https://github.com/Zeblote/Tool_NewDuplicator/blob/master/classes/server/selection.cs#L1507-#L1513
« Last Edit: February 12, 2016, 05:27:17 AM by Zeblote »

Thanks, that's exactly what i needed.

keywords: Ghost bricks/ghost brick, how to make ghost bricks with code, how to shift/move/transform ghost bricks, spawn ghost brick, create ghost brick

Leaving this open if anyone else has things to say about this topic.

i hate the fact that ghost brick clicking noises are client sided

[size =5pt]keywords: Ghost bricks/ghost brick, how to make ghost bricks with code, how to shift/move/transform ghost bricks, spawn ghost brick, create ghost brick[/size]
This is actually a pretty good idea.

This is actually a pretty good idea.
do it in all the posts that are useful - i started doing it about 3 months ago, but before today i always put [color=transparent ] tags around it, so nobody noticed.

Conan, check the functions "buildcomplexbrick()" and "moveStructure()" from the code I send you a few days back. It literally does this.

Conan, check the functions "buildcomplexbrick()" and "moveStructure()" from the code I send you a few days back. It literally does this.
i ended up deciding to recode from scratch, and its been a pretty rough path but very educational.

Ok, that's great but you could get an idea of what you want to do using the code I sent you. You can learn how the bricks are made and how they're moved and from that, do it yourself. Note, never put "Planted=true;" in the datablock for the ghost brick and your bricks will keep bein ghosts until you call fxdtsbrick::plant() on them.