Spaces:
Runtime error
Runtime error
using System; | |
using System.Collections.Generic; | |
using Photon.Deterministic; | |
namespace Quantum | |
{ | |
unsafe partial struct Chain | |
{ | |
public void Update(FrameThreadSafe frame, ref ChainSystem.Filter filter) | |
{ | |
FPVector3 direction = filter.Transform->Position - LastPosition; | |
Alpha = direction.Magnitude / DistanceThreshold; | |
// cycle element | |
if (Alpha > FP._1) | |
{ | |
Alpha = Alpha % FP._1; | |
AddBreadCrumb(direction); | |
} | |
filter.Body->Drag = MinDrag + Count * DragPerItem; | |
if (filter.Drivable->Grounded == false) filter.Body->GravityScale = FP._1; | |
filter.Drivable->Grounded = false; | |
for (int i = 0; i < Positions.Length; i++) | |
{ | |
Draw.Sphere(Positions[i], FP._0_10, ColorRGBA.ColliderBlue); | |
} | |
} | |
public void AddBreadCrumb(FPVector3 direction) | |
{ | |
FPVector3 newPosition = LastPosition + direction.Normalized * DistanceThreshold; | |
*Positions.GetPointer(Current) = newPosition; | |
Current = (Current + 1) % Positions.Length; | |
LastPosition = newPosition; | |
} | |
} | |
} | |