Setting position of graph node to centre of graph edit view

Godot Version



Hi, So i’m making an addon for my project. It uses graph edit and graphs nodes.

Currently im trying to set the position of a node to the centre of the view when the node is added as a child to the graph edit.

At the moment I add the node to the centre of graph edit with this:

node.PositionOffset = new Vector2(currentGraph.Size.X / 2, currentGraph.Size.Y / 2);

But instead I would like the node to be positioned to the centre of where the user is looking rather than the centre of the whole graph.

Any ideas how I might achieve this?

Currently using c# but Ill also accept gdscript as I’ll just convert it.