Real-time Constructive Solid Geometry plugin that dynamically clips objects as they move in and out of specified areas. Inspired by Skyward Sword's Timegate crystals, solving the "half-in, half-out" problem with smooth geometry transitions.
Traditional area-based effects (like Skyward Sword's Timegate crystals) use simple show/hide logic. When objects cross zone boundaries, they either pop in/out instantly or have jarring transitions. This breaks immersion and creates visual artifacts for large objects spanning boundaries.
Real-time CSG system that continuously regenerates mesh geometry and collision as objects move. Objects smoothly appear/disappear with proper clipped geometry, maintaining visual coherence and physical accuracy even when partially inside zones.
Time manipulation crystals
Hit crystals to reveal different time periods. Objects smoothly transition between present (desert) and past (lush) versions as they move in/out of the temporal field.
Platform visibility control
Ring bells to enable/disable platforms in specific radii. Players must position themselves strategically as geometry phases in and out of existence.
Dimensional rifts and zones
Create dimensional tears where different realities overlap. Objects exist in multiple dimensions simultaneously, visible only in specific zones.
Area-based logical challenges
Design puzzles requiring players to manipulate multiple zones to create paths, reveal hidden objects, or access previously unreachable areas.
The system uses Unreal's GeometryScripting plugin for real-time CSG operations, combined with custom collision detection and material management.
// CSG-enabled actor in your level
UCLASS()
class YOURGAME_API ACSGActor : public AActor
{
GENERATED_BODY()
public:
ACSGActor()
{
// Create the CSG static mesh component
CSGMesh = CreateDefaultSubobject<UCSGStaticMeshComponent>(TEXT("CSGMesh"));
RootComponent = CSGMesh;
// Configure collision for CSG detection
CollisionComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Collision"));
CollisionComponent->SetCollisionResponseToChannel(ECC_GameTraceChannel1, ECR_Block);
CollisionComponent->AttachToComponent(RootComponent,
FAttachmentTransformRules::KeepRelativeTransform);
}
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
class UCSGStaticMeshComponent* CSGMesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
class UStaticMeshComponent* CollisionComponent;
};
Collision Channel: Custom trace channel for CSG detection
Default Area Material: Editor visualization material for CSG zones
Do Reverse CSG: Show inside vs outside zones
Materials Array: Multi-material support
CSG Material: Material for cut surfaces
Mesh Setting: Static mesh with CPU access enabled
Allow CPU Access: Required for real-time geometry modification
GetVisualMesh(): Override for custom geometry generation
GetCollisionMesh(): Custom collision geometry creation
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class YOURGAME_API UCustomCSGComponent : public UCSGBaseComponent
{
GENERATED_BODY()
public:
UCustomCSGComponent();
protected:
// Override to provide custom visual geometry
virtual void GetVisualMesh(UDynamicMesh* OutMesh) override
{
// Generate your custom geometry here
// Could be procedural, skeletal mesh conversion, etc.
// Example: Create a procedural box
FGeometryScriptPrimitiveOptions PrimOptions;
UGeometryScriptLibrary_MeshPrimitiveFunctions::AppendBox(
OutMesh, PrimOptions, FTransform::Identity,
BoxSize.X, BoxSize.Y, BoxSize.Z
);
}
// Override to provide custom collision geometry
virtual void GetCollisionMesh(UDynamicMesh* OutMesh) override
{
// Generate collision mesh (can be same as visual or optimized version)
GetVisualMesh(OutMesh);
}
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom CSG")
FVector BoxSize = FVector(100.0f, 100.0f, 100.0f);
};
The system works excellently with simple shapes and moderate polygon counts. CSG operations are performed efficiently using Unreal's GeometryScripting, and collision detection uses custom channels for optimal performance.
Performance degrades with high-polygon meshes due to real-time geometry generation requirements. The "Allow CPU Access" requirement also impacts memory usage. Currently limited to static meshes (skeletal mesh support possible but not implemented due to complexity).
# 1. Install the plugin
# Download from GitHub and place in your project's Plugins folder
# 2. Enable required plugins
# - CSGArea (this plugin)
# - GeometryScripting (Unreal built-in)
# 3. Configure project settings
# Project Settings -> Plugins -> CSGArea Settings
# - Set custom collision channel
# - Configure default area material
# 4. Prepare your static meshes
# For any mesh you want to use with CSG:
# - Open the Static Mesh asset
# - Enable "Allow CPU Access" in Build Settings
# - Save the asset
# 5. Create CSG actors in your level
# - Add actors with CSGStaticMeshComponent
# - Add collision components using the configured collision channel
# - Set up your materials array and CSG material
# 6. Create CSG areas
# - Place CSGArea actors to define zones
# - Configure "Do Reverse CSG" as needed
# - Test the dynamic geometry transitions
The CSG Area plugin opens up new possibilities for area-based gameplay mechanics. From time manipulation to dimensional puzzles, create smooth transitions that maintain immersion and visual coherence.