private AssetMVPT FindMVPTWithRadius(AssetMVPT MVPT, out bool found, List <uint> list) { if (MVPT != null) { if (MVPT.ZoneRadius != -1f) { found = true; return(MVPT); } foreach (AssetID assetID in MVPT.NextMVPTs) { foreach (ArchiveEditor ae in Program.MainForm.archiveEditors) { if (ae.archive.ContainsAsset(assetID)) { Asset asset = ae.archive.GetFromAssetID(assetID); if (asset is AssetMVPT MVPT2 && !list.Contains(assetID)) { list.Add(assetID); return(FindMVPTWithRadius(MVPT2, out found, list)); } } } } } found = false; return(null); }
public override Matrix PlatLocalTranslation() { if (currentMVPT != null) { Vector3 newPosition = Vector3.Lerp(oldPosition, targetPosition, Math.Min(1f, LocalFrameCounter / (Vector3.Distance(oldPosition, targetPosition) / (Math.Abs(Speed) / 60f)))); if (newPosition == targetPosition) { LocalFrameCounter = 0; oldPosition = targetPosition; if (currentMVPT.NextMVPTs.Length > 0) { currentMVPT = FindMVPT(currentMVPT.NextMVPTs[0]); targetPosition = new Vector3(currentMVPT.PositionX, currentMVPT.PositionY, currentMVPT.PositionZ); } else { Reset(); } } return(Matrix.Translation(newPosition)); } return(Matrix.Translation(oldPosition)); }
public override void Reset() { currentMVPT = FindMVPT(MVPT_AssetID); if (currentMVPT != null) { targetPosition = new Vector3(currentMVPT.PositionX, currentMVPT.PositionY, currentMVPT.PositionZ); oldPosition = targetPosition; } else { oldPosition = initialPosition; } base.Reset(); }
public override Matrix LocalWorld() { if (movementPreview && MovePoint_AssetID != 0) { AssetMVPT driver = FindMVPT(out bool found); if (found) { return(Matrix.Scaling(_scale) * Matrix.Translation(driver.PositionX, driver.PositionY, driver.PositionZ) * Matrix.Translation((float)(driver.ZoneRadius * Math.Cos(localFrameCounter * Math.PI / 180f)), 0f, (float)(driver.ZoneRadius * Math.Sin(localFrameCounter * Math.PI / 180f)))); } } return(base.LocalWorld()); }