multiplayer stuff
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user