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); }
public void SaveExport(UInt32 step) { if (step < _minStep) { _initialized = false; } if (!_initialized) { _maxStep = step; _initialized = true; _maxIndex = 0; _index = 0; } if (step == _maxStep + 1 || _index == 0) { if (_index == _exportsCapacity) { _index = 0; } PBodyExport3D export = bodyExports[_index]; export.linearVelocity = linearVelocity; export.angularVelocity = angularVelocity; export.position = position; export.orientation = orientation; export.orientation0 = orientation0; export.awake = awake; export.sleepTime = sleepTime; bodyExports[_index] = export; _maxIndex = _index; _maxStep = step; if (_maxStep - _minStep >= _exportsCapacity) { _minStep = _maxStep - _exportsCapacity + 1; } _index++; } else { int index = CalculateExportIndex(step); _index = index; PBodyExport3D export = bodyExports[_index]; export.linearVelocity = linearVelocity; export.angularVelocity = angularVelocity; export.position = position; export.orientation = orientation; export.orientation0 = orientation0; export.awake = awake; export.sleepTime = sleepTime; bodyExports[_index] = export; _maxIndex = _index; _maxStep = step; _index++; } }