multiplayer stuff

This commit is contained in:
2025-07-01 18:57:49 +02:00
parent 04675ce941
commit 315661ed8d
48 changed files with 5298 additions and 349 deletions

View File

@@ -125,6 +125,21 @@ namespace RebootReality.jelycho.Ropes {
m_Ropes.Add(rope);
}
public void SpawnLockedRope(float ropeLength, float3 start, float3 end) {
int segmentsCount = (int)(ropeLength / m_RopeSegmentLength) + 1;
NativeArray<float3> positions = new NativeArray<float3>(segmentsCount, Allocator.Temp);
for (int i = 0; i < segmentsCount; ++i) {
float t = (float)i / (segmentsCount - 1);
positions[i] = math.lerp(start, end, t);
}
RopeData rope = new RopeData(positions);
rope.IsLocked[0] = true;
rope.IsLocked[rope.SegmentCount - 1] = true;
m_Ropes.Add(rope);
}
// @NOTE: Do not dispose the returned array, it is managed by the RopesManager.
public NativeArray<float3> PeekRopePositions(int index) {
return m_Ropes[index].Positions;