public void updateFromPoint(ClothPoint point, IWorldAccessor world) { PointIndex = point.PointIndex; Mass = point.Mass; InvMass = point.InvMass; Pos.Set(point.Pos); Velocity.Set(point.Pos); Tension.Set(point.Tension); GravityStrength = point.GravityStrength; pinned = point.pinned; pinnedToEntityId = point.pinnedToEntityId; if (pinnedToEntityId != 0) { pinnedTo = world.GetEntityById(pinnedToEntityId); if (pinnedTo != null) { PinTo(pinnedTo, pinnedToOffset); } else { UnPin(); } } pinnedToBlockPos = pinnedToBlockPos.SetOrCreate(point.pinnedToBlockPos); pinnedToOffset = pinnedToOffset.SetOrCreate(point.pinnedToOffset); pinnedToOffsetStartYaw = point.pinnedToOffsetStartYaw; }
public void restoreReferences(ClothSystem cs, IWorldAccessor world) { this.cs = cs; if (pinnedToEntityId != 0) { pinnedTo = world.GetEntityById(pinnedToEntityId); if (pinnedTo == null) { UnPin(); } else { PinTo(pinnedTo, pinnedToOffset); } } }