flockbay 0.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/bin/flockbay-mcp.mjs +56 -0
- package/bin/flockbay.mjs +78 -0
- package/dist/codex/flockbayMcpStdioBridge.cjs +383 -0
- package/dist/codex/flockbayMcpStdioBridge.d.cts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.d.mts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.mjs +381 -0
- package/dist/flockbayScreenshotGate-DJX3Is5d.mjs +136 -0
- package/dist/flockbayScreenshotGate-DkxU24cR.cjs +138 -0
- package/dist/index--o4BPz5o.cjs +10311 -0
- package/dist/index-CUp3juDS.mjs +10268 -0
- package/dist/index.cjs +43 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +40 -0
- package/dist/lib.cjs +33 -0
- package/dist/lib.d.cts +957 -0
- package/dist/lib.d.mts +957 -0
- package/dist/lib.mjs +23 -0
- package/dist/runCodex-D3eT-TvB.cjs +3449 -0
- package/dist/runCodex-o6PCbHQ7.mjs +3446 -0
- package/dist/runGemini-Bt0oEj_g.mjs +3183 -0
- package/dist/runGemini-CBxZp6I7.cjs +3185 -0
- package/dist/types-C-jnUdn_.cjs +4498 -0
- package/dist/types-DGd6ea2Z.mjs +4450 -0
- package/kits/kit.open_world/kit.json +59 -0
- package/package.json +130 -0
- package/scripts/claude_local_launcher.cjs +73 -0
- package/scripts/claude_remote_launcher.cjs +16 -0
- package/scripts/claude_version_utils.cjs +391 -0
- package/scripts/ripgrep_launcher.cjs +33 -0
- package/scripts/session_hook_forwarder.cjs +49 -0
- package/scripts/test-codex-abort-history.mjs +77 -0
- package/scripts/unpack-tools.cjs +222 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +7 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +184 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Config/FilterPlugin.ini +8 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1160 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +924 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommonUtils.cpp +709 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPEditorCommands.cpp +896 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPProjectCommands.cpp +72 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPUMGCommands.cpp +544 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/MCPServerRunnable.cpp +321 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPBridge.cpp +419 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPModule.cpp +21 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintCommands.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +27 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPEditorCommands.h +40 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/MCPServerRunnable.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPBridge.h +64 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPModule.h +22 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/UnrealMCP.Build.cs +78 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/UnrealMCP.uplugin +36 -0
- package/tools/unreal-mcp/upstream/Python/README.md +40 -0
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -0
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +203 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +497 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +194 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +267 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +618 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +366 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +390 -0
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +420 -0
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -0
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +430 -0
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +64 -0
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +333 -0
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -0
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
Test script for blueprint variables and physics via MCP.
|
|
4
|
+
This script creates a physical obstacle with configurable variables controlling its behavior.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import time
|
|
10
|
+
import socket
|
|
11
|
+
import json
|
|
12
|
+
import logging
|
|
13
|
+
from typing import Dict, Any, Optional
|
|
14
|
+
|
|
15
|
+
# Add the parent directory to the path so we can import the server module
|
|
16
|
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
|
17
|
+
|
|
18
|
+
# Set up logging
|
|
19
|
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
20
|
+
logger = logging.getLogger("TestPhysicsVariables")
|
|
21
|
+
|
|
22
|
+
def send_command(sock: socket.socket, command: str, params: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
23
|
+
"""Send a command to the Unreal MCP server and get the response."""
|
|
24
|
+
try:
|
|
25
|
+
# Create command object
|
|
26
|
+
command_obj = {
|
|
27
|
+
"type": command,
|
|
28
|
+
"params": params
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Convert to JSON and send
|
|
32
|
+
command_json = json.dumps(command_obj)
|
|
33
|
+
logger.info(f"Sending command: {command_json}")
|
|
34
|
+
sock.sendall(command_json.encode('utf-8'))
|
|
35
|
+
|
|
36
|
+
# Receive response
|
|
37
|
+
chunks = []
|
|
38
|
+
while True:
|
|
39
|
+
chunk = sock.recv(4096)
|
|
40
|
+
if not chunk:
|
|
41
|
+
break
|
|
42
|
+
chunks.append(chunk)
|
|
43
|
+
|
|
44
|
+
# Try parsing to see if we have a complete response
|
|
45
|
+
try:
|
|
46
|
+
data = b''.join(chunks)
|
|
47
|
+
json.loads(data.decode('utf-8'))
|
|
48
|
+
# If we can parse it, we have the complete response
|
|
49
|
+
break
|
|
50
|
+
except json.JSONDecodeError:
|
|
51
|
+
# Not a complete JSON object yet, continue receiving
|
|
52
|
+
continue
|
|
53
|
+
|
|
54
|
+
# Parse response
|
|
55
|
+
data = b''.join(chunks)
|
|
56
|
+
response = json.loads(data.decode('utf-8'))
|
|
57
|
+
logger.info(f"Received response: {response}")
|
|
58
|
+
return response
|
|
59
|
+
|
|
60
|
+
except Exception as e:
|
|
61
|
+
logger.error(f"Error sending command: {e}")
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
def main():
|
|
65
|
+
"""Main function to test physics variables in blueprints."""
|
|
66
|
+
try:
|
|
67
|
+
# Step 1: Create blueprint for a physics-based obstacle
|
|
68
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
69
|
+
sock.connect(("127.0.0.1", 55557))
|
|
70
|
+
|
|
71
|
+
bp_params = {
|
|
72
|
+
"name": "PhysicsObstacleBP",
|
|
73
|
+
"parent_class": "Actor"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
response = send_command(sock, "create_blueprint", bp_params)
|
|
77
|
+
|
|
78
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
79
|
+
logger.error(f"Failed to create blueprint: {response}")
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
# Check if blueprint already existed
|
|
83
|
+
if response.get("result", {}).get("already_exists"):
|
|
84
|
+
logger.info(f"Blueprint 'PhysicsObstacleBP' already exists, reusing it")
|
|
85
|
+
else:
|
|
86
|
+
logger.info("Blueprint created successfully!")
|
|
87
|
+
|
|
88
|
+
# Close and reopen connection for each command
|
|
89
|
+
sock.close()
|
|
90
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
91
|
+
sock.connect(("127.0.0.1", 55557))
|
|
92
|
+
|
|
93
|
+
# Step 2: Add variables to control physics behavior
|
|
94
|
+
var_params_list = [
|
|
95
|
+
{
|
|
96
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
97
|
+
"variable_name": "Mass",
|
|
98
|
+
"variable_type": "Float",
|
|
99
|
+
"default_value": 10.0,
|
|
100
|
+
"is_exposed": True
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
104
|
+
"variable_name": "RotationSpeed",
|
|
105
|
+
"variable_type": "Float",
|
|
106
|
+
"default_value": 100.0,
|
|
107
|
+
"is_exposed": True
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
111
|
+
"variable_name": "BounceFactor",
|
|
112
|
+
"variable_type": "Float",
|
|
113
|
+
"default_value": 0.8,
|
|
114
|
+
"is_exposed": True
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
118
|
+
"variable_name": "IsTrigger",
|
|
119
|
+
"variable_type": "Boolean",
|
|
120
|
+
"default_value": False,
|
|
121
|
+
"is_exposed": True
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
for var_params in var_params_list:
|
|
126
|
+
response = send_command(sock, "add_blueprint_variable", var_params)
|
|
127
|
+
|
|
128
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
129
|
+
logger.error(f"Failed to add variable: {response}")
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
logger.info(f"Variable {var_params['variable_name']} added successfully!")
|
|
133
|
+
|
|
134
|
+
# Close and reopen connection
|
|
135
|
+
sock.close()
|
|
136
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
137
|
+
sock.connect(("127.0.0.1", 55557))
|
|
138
|
+
|
|
139
|
+
# Step 3: Add a static mesh component for the obstacle
|
|
140
|
+
component_params = {
|
|
141
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
142
|
+
"component_type": "StaticMesh",
|
|
143
|
+
"component_name": "ObstacleMesh",
|
|
144
|
+
"location": [0.0, 0.0, 0.0],
|
|
145
|
+
"rotation": [0.0, 0.0, 0.0],
|
|
146
|
+
"scale": [1.0, 1.0, 1.0]
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
response = send_command(sock, "add_component_to_blueprint", component_params)
|
|
150
|
+
|
|
151
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
152
|
+
logger.error(f"Failed to add component: {response}")
|
|
153
|
+
return
|
|
154
|
+
|
|
155
|
+
logger.info("Obstacle mesh component added successfully!")
|
|
156
|
+
|
|
157
|
+
# Close and reopen connection
|
|
158
|
+
sock.close()
|
|
159
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
160
|
+
sock.connect(("127.0.0.1", 55557))
|
|
161
|
+
|
|
162
|
+
# Step 4: Set physics properties using the variables
|
|
163
|
+
physics_params = {
|
|
164
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
165
|
+
"component_name": "ObstacleMesh",
|
|
166
|
+
"simulate_physics": True,
|
|
167
|
+
"gravity_enabled": True
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
response = send_command(sock, "set_physics_properties", physics_params)
|
|
171
|
+
|
|
172
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
173
|
+
logger.error(f"Failed to set physics properties: {response}")
|
|
174
|
+
return
|
|
175
|
+
|
|
176
|
+
logger.info("Physics properties set successfully!")
|
|
177
|
+
|
|
178
|
+
# Close and reopen connection
|
|
179
|
+
sock.close()
|
|
180
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
181
|
+
sock.connect(("127.0.0.1", 55557))
|
|
182
|
+
|
|
183
|
+
# Step 5: Add BeginPlay event node
|
|
184
|
+
begin_play_params = {
|
|
185
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
186
|
+
"event_type": "BeginPlay",
|
|
187
|
+
"node_position": [0, 0]
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
response = send_command(sock, "add_blueprint_event_node", begin_play_params)
|
|
191
|
+
|
|
192
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
193
|
+
logger.error(f"Failed to add BeginPlay event node: {response}")
|
|
194
|
+
return
|
|
195
|
+
|
|
196
|
+
logger.info("BeginPlay event node added successfully!")
|
|
197
|
+
|
|
198
|
+
# Save the node ID for later connections
|
|
199
|
+
begin_play_node_id = response.get("result", {}).get("node_id")
|
|
200
|
+
|
|
201
|
+
# Close and reopen connection
|
|
202
|
+
sock.close()
|
|
203
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
204
|
+
sock.connect(("127.0.0.1", 55557))
|
|
205
|
+
|
|
206
|
+
# Step 6: Add Tick event node
|
|
207
|
+
tick_params = {
|
|
208
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
209
|
+
"event_type": "Tick",
|
|
210
|
+
"node_position": [0, 200]
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
response = send_command(sock, "add_blueprint_event_node", tick_params)
|
|
214
|
+
|
|
215
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
216
|
+
logger.error(f"Failed to add Tick event node: {response}")
|
|
217
|
+
return
|
|
218
|
+
|
|
219
|
+
logger.info("Tick event node added successfully!")
|
|
220
|
+
|
|
221
|
+
# Save the node ID for later connections
|
|
222
|
+
tick_node_id = response.get("result", {}).get("node_id")
|
|
223
|
+
|
|
224
|
+
# Close and reopen connection
|
|
225
|
+
sock.close()
|
|
226
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
227
|
+
sock.connect(("127.0.0.1", 55557))
|
|
228
|
+
|
|
229
|
+
# Step 7: Add function node to set mesh physics settings from variables
|
|
230
|
+
function_params = {
|
|
231
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
232
|
+
"target": "ObstacleMesh",
|
|
233
|
+
"function_name": "SetMassScale",
|
|
234
|
+
"params": {
|
|
235
|
+
"BoneName": "None",
|
|
236
|
+
"InMassScale": 10.0 # This will be replaced by the Mass variable dynamically
|
|
237
|
+
},
|
|
238
|
+
"node_position": [300, 0]
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
response = send_command(sock, "add_blueprint_function_node", function_params)
|
|
242
|
+
|
|
243
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
244
|
+
logger.error(f"Failed to add function node: {response}")
|
|
245
|
+
return
|
|
246
|
+
|
|
247
|
+
logger.info("SetMassScale function node added successfully!")
|
|
248
|
+
|
|
249
|
+
# Save the node ID for later connections
|
|
250
|
+
set_mass_node_id = response.get("result", {}).get("node_id")
|
|
251
|
+
|
|
252
|
+
# Close and reopen connection
|
|
253
|
+
sock.close()
|
|
254
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
255
|
+
sock.connect(("127.0.0.1", 55557))
|
|
256
|
+
|
|
257
|
+
# Step 8: Add function node to rotate the obstacle
|
|
258
|
+
function_params = {
|
|
259
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
260
|
+
"target": "ObstacleMesh",
|
|
261
|
+
"function_name": "AddTorqueInRadians",
|
|
262
|
+
"params": {
|
|
263
|
+
"Torque": [0, 0, 100.0], # This should be connected to the RotationSpeed variable
|
|
264
|
+
"BoneName": "None",
|
|
265
|
+
"bAccelChange": True
|
|
266
|
+
},
|
|
267
|
+
"node_position": [300, 200]
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
response = send_command(sock, "add_blueprint_function_node", function_params)
|
|
271
|
+
|
|
272
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
273
|
+
logger.error(f"Failed to add function node: {response}")
|
|
274
|
+
return
|
|
275
|
+
|
|
276
|
+
logger.info("AddTorqueInRadians function node added successfully!")
|
|
277
|
+
|
|
278
|
+
# Save the node ID for later connections
|
|
279
|
+
add_torque_node_id = response.get("result", {}).get("node_id")
|
|
280
|
+
|
|
281
|
+
# Close and reopen connection
|
|
282
|
+
sock.close()
|
|
283
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
284
|
+
sock.connect(("127.0.0.1", 55557))
|
|
285
|
+
|
|
286
|
+
# Step 9: Connect BeginPlay to SetMassScale
|
|
287
|
+
connect_params = {
|
|
288
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
289
|
+
"source_node_id": begin_play_node_id,
|
|
290
|
+
"source_pin": "Then", # Execute pin on BeginPlay event
|
|
291
|
+
"target_node_id": set_mass_node_id,
|
|
292
|
+
"target_pin": "execute" # Execute pin on function
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
response = send_command(sock, "connect_blueprint_nodes", connect_params)
|
|
296
|
+
|
|
297
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
298
|
+
logger.error(f"Failed to connect nodes: {response}")
|
|
299
|
+
return
|
|
300
|
+
|
|
301
|
+
logger.info("BeginPlay connected to SetMassScale successfully!")
|
|
302
|
+
|
|
303
|
+
# Close and reopen connection
|
|
304
|
+
sock.close()
|
|
305
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
306
|
+
sock.connect(("127.0.0.1", 55557))
|
|
307
|
+
|
|
308
|
+
# Step 10: Connect Tick to AddTorqueInRadians
|
|
309
|
+
connect_params = {
|
|
310
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
311
|
+
"source_node_id": tick_node_id,
|
|
312
|
+
"source_pin": "Then", # Execute pin on Tick event
|
|
313
|
+
"target_node_id": add_torque_node_id,
|
|
314
|
+
"target_pin": "execute" # Execute pin on function
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
response = send_command(sock, "connect_blueprint_nodes", connect_params)
|
|
318
|
+
|
|
319
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
320
|
+
logger.error(f"Failed to connect nodes: {response}")
|
|
321
|
+
return
|
|
322
|
+
|
|
323
|
+
logger.info("Tick connected to AddTorqueInRadians successfully!")
|
|
324
|
+
|
|
325
|
+
# Close and reopen connection
|
|
326
|
+
sock.close()
|
|
327
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
328
|
+
sock.connect(("127.0.0.1", 55557))
|
|
329
|
+
|
|
330
|
+
# Step 11: Compile the blueprint
|
|
331
|
+
compile_params = {
|
|
332
|
+
"blueprint_name": "PhysicsObstacleBP"
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
response = send_command(sock, "compile_blueprint", compile_params)
|
|
336
|
+
|
|
337
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
338
|
+
logger.error(f"Failed to compile blueprint: {response}")
|
|
339
|
+
return
|
|
340
|
+
|
|
341
|
+
logger.info("Blueprint compiled successfully!")
|
|
342
|
+
|
|
343
|
+
# Close and reopen connection
|
|
344
|
+
sock.close()
|
|
345
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
346
|
+
sock.connect(("127.0.0.1", 55557))
|
|
347
|
+
|
|
348
|
+
# Step 12: Spawn multiple instances of the obstacle at different positions
|
|
349
|
+
positions = [
|
|
350
|
+
[100.0, 0.0, 200.0],
|
|
351
|
+
[0.0, 100.0, 200.0],
|
|
352
|
+
[-100.0, 0.0, 200.0],
|
|
353
|
+
[0.0, -100.0, 200.0]
|
|
354
|
+
]
|
|
355
|
+
|
|
356
|
+
for i, position in enumerate(positions):
|
|
357
|
+
spawn_params = {
|
|
358
|
+
"blueprint_name": "PhysicsObstacleBP",
|
|
359
|
+
"actor_name": f"Obstacle_{i+1}",
|
|
360
|
+
"location": position,
|
|
361
|
+
"rotation": [0.0, 0.0, 45.0 * i], # Different rotations
|
|
362
|
+
"scale": [1.0, 1.0, 1.0]
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
response = send_command(sock, "spawn_blueprint_actor", spawn_params)
|
|
366
|
+
|
|
367
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
368
|
+
logger.error(f"Failed to spawn blueprint actor {i+1}: {response}")
|
|
369
|
+
return
|
|
370
|
+
|
|
371
|
+
logger.info(f"Obstacle {i+1} spawned successfully!")
|
|
372
|
+
|
|
373
|
+
# Close and reopen connection
|
|
374
|
+
if i < len(positions) - 1: # Don't reopen if this is the last one
|
|
375
|
+
sock.close()
|
|
376
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
377
|
+
sock.connect(("127.0.0.1", 55557))
|
|
378
|
+
|
|
379
|
+
logger.info("Physics obstacles created successfully!")
|
|
380
|
+
logger.info("The obstacles should start rotating due to the Tick event connection")
|
|
381
|
+
|
|
382
|
+
# Close final connection
|
|
383
|
+
sock.close()
|
|
384
|
+
|
|
385
|
+
except Exception as e:
|
|
386
|
+
logger.error(f"Error: {e}")
|
|
387
|
+
sys.exit(1)
|
|
388
|
+
|
|
389
|
+
if __name__ == "__main__":
|
|
390
|
+
main()
|