Start interaction when mouse is not on geometry

Mar 18, 2011 at 10:02 AM

Hi there,

I am drawing my own "point cloud geometry" with some small boxes as points.
InteractionEnabled is set to true (or to be exact, I'm using my own ManipulationStarted, -Delta and -Stopped methods).
When I click on any box in my geometry and move the mouse, the interaction works fine.
But when I click somewhere in the open (not on a box) and move around, the Manipulation methods do not fire.

What is the easiest way to manipulate the geometry wherever I click in the scene?
Should I add an (invisible) plane in the background, which causes the hit test to pass, or is there a simpler way?

Thanks in advance.

Gr, Sander

Mar 18, 2011 at 10:22 AM


Not sure if I understand what you are trying to do but the Balder Viewer will give you mouse feed back events.

If thats what you need then just hookup the viewer mouse events that you require.

For example:

this.MouseMove += MyBalderViewerMouseMove;

void MyBalderViewerMouseMove(object sender,MouseEventArgs e)


         var mousePoint = e.GetPosition(this);

         // or whatever you want todo.


(sorry for the unformatted code for some reason it will not paste).


Mar 18, 2011 at 10:52 AM
Edited Mar 18, 2011 at 10:52 AM

StuartTrez, thanks for your quick reply!

Unfortunately, that's not really what I mean. Let me provide some code. (See below.)

My problem is that the MyGeometry_ManipulationDelta method only fires when I'm clicking (and moving the mouse) exactly on one of the faces I draw in DrawPoints(), while I would like it to be fired wherever I click in the Game area.

I hope anyone can help. If it's still unclear, please tell me.

Gr, Sander


<UserControl ... xmlns:Custom="clr-namespace:MySilverlightApplication">

<Execution:Game Name="myBalderGameObject" Width="640" Height="480">
		<View:Camera Position="0,0,-20" />
	<Lighting:OmniLight Position="0,2,-10" Strength="1" Diffuse="White" />
	<Custom:MyGeometry x:Name="myGeometry" Color="Blue" />



public class MyGeometry : Balder.Objects.Geometries.Geometry
	public MyGeometry()
		: base()

	public void DrawPoints()
		// drawing small boxes here

	public override void Prepare(Balder.Display.Viewport viewport)
		this.ManipulationDelta += new Balder.Input.ManipulationDeltaEventHandler(MyGeometry_ManipulationDelta);

	void MyGeometry_ManipulationDelta(object sender, Balder.Input.ManipulationDeltaEventArgs args)
		// manipulation	
		var rotation = Balder.Math.Matrix.CreateRotation(0, (float)-args.DeltaX, 0);
		var rotation2 = Balder.Math.Matrix.CreateRotation((float)-args.DeltaY, 0, 0);
		World = rotation * World * rotation2;
Mar 18, 2011 at 6:35 PM

Manipulation, interaction and mouse events that are on Nodes are only tied into the actual node, not the Game/Drawing surface. 

You could easily do as StuartTrez suggests and create the same manipulation kind logic that exist in Balder. Basically thats what Balder does internally as well, it just hooks up on a hidden Grid that encapsulates the rendering area and its mouse move and button events.

The reason this doesn't "work" today is that its intersecting the geometry and there is no geometry inbetween geometries - one could argue if there should be an similar event mechanism on the Viewport found inside the Game instead or maybe even on the game, but for the nodes I think the behavior as it is today is correct.