---
name: "SoFieldSensor"
section: "3iv"
platform: "linux"
package: "inventor-doc"
version: "2.1.6+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SoFieldSensor/3iv"
---

# SoFieldSensor(3iv)

sensor class that can be attached to Inventor fields

## NAME

SoFieldSensor — sensor class that can be attached to Inventor fields

## INHERITS FROM

SoSensor \> SoDelayQueueSensor \> SoDataSensor \> SoFieldSensor

## SYNOPSIS

**#include \<Inventor/sensors/SoFieldSensor.h\>**

Methods from class SoFieldSensor:

	**SoFieldSensor()**\
 	**SoFieldSensor(SoSensorCB \*func, void \*data)**\
 	**~SoFieldSensor()**\
 **void**	**attach(SoField \*field)**\
 **void**	**detach()**\
 **SoField \***	**getAttachedField() const**

Methods from class SoDataSensor:

**void**	**setDeleteCallback(SoSensorCB \*function, void \*data)**\
 **SoNode \***	**getTriggerNode() const**\
 **SoField \***	**getTriggerField() const**\
 **SoPath \***	**getTriggerPath() const**\
 **void**	**setTriggerPathFlag(SbBool flag)**\
 **SbBool**	**getTriggerPathFlag() const**

Methods from class SoDelayQueueSensor:

**void**	**setPriority(uint32\_t pri)**\
 **uint32\_t**	**getPriority()**\
 **static uint32\_t**	**getDefaultPriority()**\
 **virtual void**	**schedule()**\
 **virtual void**	**unschedule()**\
 **virtual SbBool**	**isScheduled()**

Methods from class SoSensor:

**void**	**setFunction(SoSensorCB \*callbackFunction)**\
 **SoSensorCB \***	**getFunction() const**\
 **void**	**setData(void \*callbackData)**\
 **void \***	**getData() const**

## DESCRIPTION

**Field sensors detect changes to fields, calling a callback function whenever the field changes. The field may be part of a node, an input of an engine, or a global field.**

## METHODS

	**SoFieldSensor()**\
 	**SoFieldSensor(SoSensorCB \*func, void \*data)**\
 Creation methods. The second method takes the callback function and data to be called when the sensor is triggered.

	**~SoFieldSensor()**\
 Destroys the sensor, freeing up any memory associated with it after unscheduling it.

**void**	**attach(SoField \*field)**\
 **void**	**detach()**\
 **SoField \***	**getAttachedField() const**\
 The **attach()** method makes this sensor detect changes to the given field. The **detach()** method unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph. The **getAttachedField()** method returns the field that this sensor is sensing, or NULL if it is not attached to any field.

## SEE ALSO

**SoNodeSensor, SoPathSensor, SoDataSensor**
