-
Notifications
You must be signed in to change notification settings - Fork 0
/
HIDAgent.pde
36 lines (30 loc) · 1016 Bytes
/
HIDAgent.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public class HIDAgent extends Agent {
float [] sens = {4, 4, 7, 0, 5, 5};
public HIDAgent(Scene scn) {
super(scn.inputHandler());
SN_ID = MotionShortcut.registerID(6, "SN_SENSOR");
addGrabber(mainScene.eyeFrame());
setDefaultGrabber(mainScene.eyeFrame());
}
// we need to override the agent sensitivities method for the agent
// to apply them to the input data gathered from the sliders
@Override
public float[] sensitivities(MotionEvent event) {
if (event instanceof DOF6Event)
return sens;
else
return super.sensitivities(event);
}
// polling is done by overriding the feed agent method
// note that we pass the id of the gesture
@Override
public DOF6Event feed() {
return new DOF6Event(defaultXPosition, defaultYPosition, defaultZPosition, 0, defaultYRotate, defaultZRotate, BogusEvent.NO_MODIFIER_MASK, SN_ID);
}
public float[] getSens(){
return this.sens;
}
public void setSens(float[] sens){
this.sens = sens;
}
}