11using Elements . Core ;
22using FrooxEngine ;
3+ using FrooxEngine . FrooxEngine . ProtoFlux . CoreNodes ;
4+ using FrooxEngine . ProtoFlux . Runtimes . Execution . Nodes ;
5+ using FrooxEngine . ProtoFlux . Runtimes . Execution . Nodes . Operators ;
36using HarmonyLib ;
47using Renderite . Shared ;
58
@@ -16,14 +19,16 @@ private static bool Prefix(World w)
1619 if ( ! Enabled )
1720 return true ;
1821
19- WorldPresets . BlankWorld ( w ) ;
22+ WorldPresets . SetupWorldControllers ( w ) ;
23+ WorldPresets . SetupSimpleSkyBox ( w , WorldPresets . SetupSimpleWorldLighting ( w ) ) ;
2024
2125 var ground = w . AddSlot ( "Ground" ) ;
22- ground . LocalRotation = floatQ . Euler ( 90 , 0 , 0 ) ;
2326
2427 var attachedModel = ground . AttachMesh < GridMesh , PBS_Metallic > ( ) ;
25- attachedModel . mesh . Size . Value = 1000 * float2 . One ;
28+ attachedModel . mesh . Facing = float3 . Up ;
2629 attachedModel . mesh . Points . Value = 20 * int2 . One ;
30+ attachedModel . mesh . Size . Value = 1000 * float2 . One ;
31+ attachedModel . mesh . UVScale . DriveFrom ( attachedModel . mesh . Size , true ) ;
2732
2833 var gridTexture = ground . AttachComponent < GridTexture > ( ) ;
2934 gridTexture . BackgroundColor . Value = new colorX ( 0.07f , 0.08f , 0.11f ) ;
@@ -45,15 +50,32 @@ private static bool Prefix(World w)
4550 majorGrid . Offset . Value = int2 . Zero ;
4651
4752 attachedModel . material . AlbedoTexture . Target = gridTexture ;
48- attachedModel . material . TextureScale . DriveFrom ( attachedModel . mesh . Size ) ;
4953 attachedModel . material . Smoothness . Value = 0f ;
5054
5155 var boxCollider = ground . AttachComponent < BoxCollider > ( ) ;
52- var swizzle = ground . AttachComponent < Float2ToFloat3SwizzleDriver > ( ) ;
53- swizzle . Source . Target = attachedModel . mesh . Size ;
54- swizzle . Target . Target = boxCollider . Size ;
56+ boxCollider . Offset . Value = new ( 0 , - 0.5f , 0 ) ;
5557 boxCollider . SetCharacterCollider ( ) ;
5658
59+ var swizzleSlot = ground . AddSlot ( "Collider Swizzle" ) ;
60+
61+ var meshSizeSource = swizzleSlot . AttachComponent < ValueSource < float2 > > ( ) ;
62+ meshSizeSource . TrySetRootSource ( attachedModel . mesh . Size ) ;
63+
64+ var unpackSize = swizzleSlot . AttachComponent < Unpack_Float2 > ( ) ;
65+ unpackSize . V . Target = meshSizeSource ;
66+
67+ var oneConstant = swizzleSlot . AttachComponent < ValueInput < float > > ( ) ;
68+ oneConstant . Value . Value = 1 ;
69+
70+ var packSize = swizzleSlot . AttachComponent < Pack_Float3 > ( ) ;
71+ packSize . X . Target = unpackSize . X ;
72+ packSize . Y . Target = oneConstant ;
73+ packSize . Z . Target = unpackSize . Y ;
74+
75+ var colliderSizeDrive = swizzleSlot . AttachComponent < ValueFieldDrive < float3 > > ( ) ;
76+ colliderSizeDrive . TrySetRootTarget ( boxCollider . Size ) ;
77+ colliderSizeDrive . Value . Target = packSize ;
78+
5779 return false ;
5880 }
5981 }
0 commit comments