Mouse Input

I wish to achieve a middle mouse camera zoom using logic nodes. However, the mouse input seems very confusing.

The mouse node “middle” + “moved” hopefully refers to the middle mouse button movement, as there is a separate node for “pointer” or actual “mouse” movement. Hence the confusion with “Wheel Delta” in Mouse movement node with dark green output??
I can’t figure out the Node set up that could work as well as a relatively simple HAXE code:

package arm;

import iron.object.CameraObject;

class CameraControls extends iron.Trait {
public function new() {
super();

var mouse = iron.system.Input.getMouse();

notifyOnUpdate(function() {
  var camera = cast(object.getChild("Camera"),CameraObject);

  if(mouse.wheelDelta != 0)
    camera.data.raw.fov += mouse.wheelDelta * 0.02;
    camera.buildProjection();

});

}

}

I don’t know if i understand you right but here is an example file: zoomInOut.blend (748.6 KB)

1 Like

Fantastic, “Set Variable Node” solves the problem. I believe I’ve seen a “gray output” being connected to “green input” before, yet this set up didn’t occur to me.

Thank you, makes sense now.

1 Like

If the green output is a dynamic type, then you can get it connected to any input. There are many nodes with dynamic type (e.g. Gate node). You can use the Gate node to compare Floats, Vectors, etc. but you can’t as far i know to connect a Scene node output (also green output) to a different input color. I guess these particular nodes uses green due to lack of color options in Blender but i am not sure :slight_smile:

Greatly appreciated, it opens up a new realm of possibilities :slight_smile:
It was my fault, sometimes I’m too “literal” as in this case with color compatibility. This was also the source of my confusion with “mouse” movement versus “mouse” event: “started”, “down”, “released”, and “moved” implying the mouse button (right, left, middle) event, which is different from physically moving the mouse to achieve “cursor” movement. Scrolling the MMB, doesn’t require a mouse to move, hence “wheel Delta” would be more appropriate on “mouse node”, rather than “mouse movement node”.

2 Likes