コード例 #1
0
ファイル: BodySet.cs プロジェクト: cwharris/bepuphysics2
 internal void ApplyDescriptionByIndex(int index, ref BodyDescription description)
 {
     BundleIndexing.GetBundleIndices(index, out var bundleIndex, out var innerIndex);
     Poses[index]         = description.Pose;
     Velocities[index]    = description.Velocity;
     LocalInertias[index] = description.LocalInertia;
     ref var collidable = ref Collidables[index];
コード例 #2
0
ファイル: BodySet.cs プロジェクト: impoetk/bepuphysics2
        internal int Add(ref BodyDescription bodyDescription, int handle, int minimumConstraintCapacity, BufferPool pool)
        {
            var index = Count;

            if (index == IndexToHandle.Length)
            {
                InternalResize(IndexToHandle.Length * 2, pool);
            }
            ++Count;
            IndexToHandle[index] = handle;
            //Collidable's broad phase index is left unset. The Bodies collection is responsible for attaching that data.
            QuickList <BodyConstraintReference, Buffer <BodyConstraintReference> > .Create(pool.SpecializeFor <BodyConstraintReference>(), minimumConstraintCapacity, out Constraints[index]);

            ApplyDescriptionByIndex(index, ref bodyDescription);
            return(index);
        }