Esempio n. 1
0
        public void WriteNative()
        {
            if (_bodyDirty)
            {
                _bodyDirty = false;
                Parallel3D.UpdateBodyProperties(
                    _body3D,
                    (int)bodyType,
                    linearDamping,
                    angularDamping,
                    gravityScale,
                    fixedRotationX,
                    fixedRotationY,
                    fixedRotationZ);
            }

            foreach (ParallelCollider3D collider in colliders)
            {
                collider.UpdateNativeShapeIfNecessary(gameObject);
            }

            if (_velocityDirty)
            {
                _velocityDirty = false;
                Parallel3D.UpdateBodyVelocity(_body3D, _tempLinearVelocity, _tempAngularVelocity);
            }
        }
Esempio n. 2
0
        public bool LoadSavedExport(UInt32 step)
        {
            if (step > _maxStep)
            {
                return(false);
            }

            if (step < _minStep)
            {
                return(false);
            }

            int index = CalculateExportIndex(step);

            PBodyExport3D export = bodyExports[index];

            linearVelocity  = export.linearVelocity;
            angularVelocity = export.angularVelocity;
            position        = export.position;
            orientation     = export.orientation;
            orientation0    = export.orientation0;
            awake           = export.awake;
            sleepTime       = export.sleepTime;

            Parallel3D.UpdateBodyTransformForRollback(this, position, orientation, orientation0);
            Parallel3D.UpdateBodyVelocity(this, linearVelocity, angularVelocity);
            Parallel3D.SetAwakeForRollback(this, awake, sleepTime);
            return(true);
        }