Spaces:
Running
Running
Download native/unreal/Source/Singularity/SingularitySpacetimeBridge.cpp from sankalphs/singularity1: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/sankalphs/singularity1/resolve/main/native/unreal/Source/Singularity/SingularitySpacetimeBridge.cpp
- Command line
-
hf download hf://spaces/sankalphs/singularity1/native/unreal/Source/Singularity/SingularitySpacetimeBridge.cpp
-
curl -L -o SingularitySpacetimeBridge.cpp https://huggingface.co/spaces/sankalphs/singularity1/resolve/main/native/unreal/Source/Singularity/SingularitySpacetimeBridge.cpp
1.45 kB
| void USingularitySpacetimeBridge::SubmitRoleInput( | |
| ESingularityBodyRole Role, | |
| float X, | |
| float Z, | |
| bool bAction, | |
| int64 ClientTick) | |
| { | |
| FSingularityRoleInput Input; | |
| if (static_cast<uint8>(Role) > 5 || !FMath::IsFinite(X) || !FMath::IsFinite(Z)) return; | |
| Input.Role = Role; | |
| Input.X = FMath::Clamp(X, -1.0f, 1.0f); | |
| Input.Z = FMath::Clamp(Z, -1.0f, 1.0f); | |
| Input.bAction = bAction; | |
| Input.ClientTick = ClientTick; | |
| OnInputReady.Broadcast(Input); | |
| } | |
| void USingularitySpacetimeBridge::ApplyTeamSnapshot(const FSingularityTeamSnapshot& Snapshot) | |
| { | |
| if (Snapshot.Nodes.Num() != 6) return; | |
| for (const FVector& Node : Snapshot.Nodes) if (Node.ContainsNaN()) return; | |
| // Snapshots are server-owned. Consumers should apply only the six nodes | |
| // and status fields supplied here; no client-side completion is accepted. | |
| OnSnapshotReady.Broadcast(Snapshot); | |
| } | |
| FString USingularitySpacetimeBridge::RoleToWireName(ESingularityBodyRole Role) | |
| { | |
| switch (Role) | |
| { | |
| case ESingularityBodyRole::EyesHead: return TEXT("0"); | |
| case ESingularityBodyRole::LeftArm: return TEXT("1"); | |
| case ESingularityBodyRole::RightArm: return TEXT("2"); | |
| case ESingularityBodyRole::TorsoBack: return TEXT("3"); | |
| case ESingularityBodyRole::LeftLeg: return TEXT("4"); | |
| case ESingularityBodyRole::RightLeg: return TEXT("5"); | |
| default: return TEXT("unknown"); | |
| } | |
| } | |