/** 初期化する。最初に一度だけ呼ぶこと */ public void setup() { spheres.reset(new Collider_Sphere[Capacity_S]); capsules.reset(new Collider_Capsule[Capacity_C]); boxes.reset(new Collider_Box[Capacity_B]); planes.reset(new Collider_Plane[Capacity_P]); }
/** 初期化する。最初に一度だけ呼ぶこと */ public void reset(List <Controller.Constraint> src, PinnedArray <Point> points) { var d = new List <Constraint_Distance>(); var a = new List <Constraint_Axis>(); foreach (var i in src) { switch (i.mode) { case Controller.Constraint.Mode.Distance: { var b = new Constraint_Distance() { compliance = i.compliance }; b.reset( points.ptr + i.srcPointIdx, points.ptr + i.dstPointIdx ); d.Add(b); } break; case Controller.Constraint.Mode.Axis: { var b = new Constraint_Axis() { compliance = i.compliance, axis = i.axis }; b.reset( points.ptr + i.srcPointIdx, points.ptr + i.dstPointIdx ); a.Add(b); } break; default: throw new InvalidProgramException(); } } distance.reset(d.ToArray()); axis.reset(a.ToArray()); }