void movableEventSource3D_MouseDrag(object sender, Ab3d.Common.EventManager3D.MouseDrag3DEventArgs e) { if (e.HitSurface != null) { // Change the position of the box and arrow line // This can be done in a couple of ways: // The most easy is to change the CenterPosition of the box and StartPosition and EndPostition of the arrow line. // But this would recreate the geometry // Therfore it is better to add a transformation to the box and line and change that // Even better is to create a parent ModelVisual3D that holds box and arrow line and transform the this ModelVisual3D // Commented: //MovableBoxVisual3D.CenterPosition = new Point3D(e.CurrentSurfaceHitPoint.X, // e.CurrentSurfaceHitPoint.Y + MovableBoxVisual3D.Size.Y / 2, // e.CurrentSurfaceHitPoint.Z); //MovableBoxTranslate.OffsetX = e.CurrentSurfaceHitPoint.X; //MovableBoxTranslate.OffsetY = e.CurrentSurfaceHitPoint.Y + MovableBoxVisual3D.Size.Y / 2; //MovableBoxTranslate.OffsetZ = e.CurrentSurfaceHitPoint.Z; //ArrowLineTranslate.OffsetX = e.CurrentSurfaceHitPoint.X; //ArrowLineTranslate.OffsetY = e.CurrentSurfaceHitPoint.Y + MovableBoxVisual3D.Size.Y / 2; //ArrowLineTranslate.OffsetZ = e.CurrentSurfaceHitPoint.Z; MovableVisualTranslate.OffsetX = e.CurrentSurfaceHitPoint.X; MovableVisualTranslate.OffsetY = e.CurrentSurfaceHitPoint.Y + MovableBoxVisual3D.Size.Y / 2; MovableVisualTranslate.OffsetZ = e.CurrentSurfaceHitPoint.Z; } }
void movableEventSource3D_MouseDrag(object sender, Ab3d.Common.EventManager3D.MouseDrag3DEventArgs e) { if (e.HitSurface != null) { MovableVisualTranslate.OffsetX = e.CurrentSurfaceHitPoint.X; MovableVisualTranslate.OffsetY = e.CurrentSurfaceHitPoint.Y + MovableBoxVisual3D.Size.Y / 2; MovableVisualTranslate.OffsetZ = e.CurrentSurfaceHitPoint.Z; } }
void OnWindGeneratorMouseDrag(object sender, Ab3d.Common.EventManager3D.MouseDrag3DEventArgs e) { if (e.HitSurface == null) // return if we do not hit Landscape (only Landscape is registered as DragSurface so HitSurface for all other objects is null) { return; } var hitWindGenerator = e.HitEventSource3D.CustomData as WindGenerator; if (hitWindGenerator != null) { hitWindGenerator.Position = new Point3D(e.CurrentSurfaceHitPoint.X, e.CurrentSurfaceHitPoint.Y, e.CurrentSurfaceHitPoint.Z); } }