import IntensityWave import Inverse innerPath = createInstance("CirclePath", "innerPath") outerPath = createInstance("CirclePath", "outerPath") anim = createInstance("TranslateAlongPath", "anim") cosineWaveInstance = createInstance("IntensityWave", "IntensityWaveInstance") inverseInstance = createInstance("Inverse", "InverseInstance") connect(outerPath.out, anim.animationPath) connect(innerPath.out, anim.objectPath) connect(inverseInstance.out, anim.duration) connect(Constant((1, 0, 0)), anim.direction) dial = sh.createSensationFromPath("DialSensation", { ("t", anim.t): (0, 0, 0), ("innerRadius", innerPath.radius): (0.005, 0, 0), ("outerRadius", outerPath.radius): (0.025, 0, 0), ("rate", inverseInstance.value): (1, 0, 0), ("t", cosineWaveInstance.t): (0, 0, 0) }, output=anim.out, intensity=cosineWaveInstance.out, drawFrequency=70, renderMode=sh.RenderMode.Loop) setMetaData(dial, "Allow-Transform", True) setMetaData(dial.innerRadius, "Type", "Scalar") setMetaData(dial.outerRadius, "Type", "Scalar") setMetaData(dial.rate, "Type", "Scalar")
from pysensationcore import * import sensation_helpers as sh pathInstance = createInstance("CirclePath", "CirclePathInstance") palmPresence = sh.createSensationFromPath("PalmPresence", { ("radius", pathInstance.radius) : (0.02, 0, 0), }, output = pathInstance.out, drawFrequency = 70, renderMode = sh.RenderMode.Loop ) defineBlockInputDefaultValue(palmPresence.intensity, (0.7, 0, 0)) setMetaData(palmPresence.radius, "Type", "Scalar")
from pysensationcore import * import sensation_helpers as sh pathInstance = createInstance("LinePath", "LinePathInstance") line = sh.createSensationFromPath("LineSensation", { ("endpointA", pathInstance.endpointA): (-0.04, 0.0, 0.0), ("endpointB", pathInstance.endpointB): (0.04, 0.0, 0.0), }, output=pathInstance.out, drawFrequency=125, definedInVirtualSpace=True) setMetaData(line.endpointA, "Type", "Point") setMetaData(line.endpointB, "Type", "Point")
from pysensationcore import * import sensation_helpers as sh polylinePath = createInstance("PolylinePath", "FingerPatchPolylinePathInstance") pointCount = 6 points = sh.createList(pointCount) connect(points["output"], polylinePath.points) fingerPatch = sh.createSensationFromPath("FingerPatch", { ("indexFinger_intermediate_position", points["inputs"][0]) : (0.0, 0.0, 0.0), ("middleFinger_intermediate_position", points["inputs"][1]) : (0.0, 0.0, 0.0), ("ringFinger_intermediate_position", points["inputs"][2]) : (0.0, 0.0, 0.0), ("ringFinger_metacarpal_position", points["inputs"][3]) : (0.0, 0.0, 0.0), ("indexFinger_metacarpal_position", points["inputs"][4]) : (0.0, 0.0, 0.0), ("indexFinger_intermediate_position", points["inputs"][5]) : (0.0, 0.0, 0.0) }, output = polylinePath.out, drawFrequency = 70, definedInVirtualSpace = True, renderMode = sh.RenderMode.Loop ) for input in [fingerPatch.indexFinger_intermediate_position, fingerPatch.middleFinger_intermediate_position, fingerPatch.ringFinger_intermediate_position, fingerPatch.ringFinger_metacarpal_position, fingerPatch.indexFinger_metacarpal_position]: setMetaData(input, "Input-Visibility", False) setMetaData(input, "Input-Group", "points")
from pysensationcore import * import sensation_helpers as sh pathInstance = createInstance("PolylinePath", "PolylinePathInstance") pointCount = 6 prefix = "point" points = sh.createList(pointCount) connect(points["output"], pathInstance.points) polyline = sh.createSensationFromPath("Polyline6", { ("point0", points["inputs"][0]) : (0.0, 0.025, 0.0), ("point1", points["inputs"][1]) : (0.024, 0.008, 0.0), ("point2", points["inputs"][2]) : (0.015, -0.02, 0.0), ("point3", points["inputs"][3]) : (-0.015, -0.02, 0.0), ("point4", points["inputs"][4]) : (-0.024, 0.008, 0.0), ("point5", points["inputs"][5]) : (0.0, 0.025, 0.0) }, output = pathInstance.out, drawFrequency = 70 ) setMetaData(polyline, "Allow-Transform", True) for inputName in [prefix + str(i) for i in range(pointCount)]: input = getattr(polyline, inputName) setMetaData(input, "Input-Group", "points") defineBlockInputDefaultValue(polyline.point0, (0.0, 0.025, 0.0)) defineBlockInputDefaultValue(polyline.point1, (0.024, 0.008, 0.0)) defineBlockInputDefaultValue(polyline.point2, (0.015, -0.02, 0.0))
# === Forcefield === quadToQuadIntersectionBlockInstance = createInstance("QuadToQuadIntersection", "quadToQuadIntersectionInstance") linePathInstance = createInstance("LinePath", "line") connect(quadToQuadIntersectionBlockInstance.endpointA, linePathInstance.endpointA) connect(quadToQuadIntersectionBlockInstance.endpointB, linePathInstance.endpointB) forcefieldBlock = sh.createSensationFromPath("ForcefieldLine", { ("palm_position", quadToQuadIntersectionBlockInstance.center0) : (0.0, 0.0, 0.0), ("palm_scaled_direction", quadToQuadIntersectionBlockInstance.up0) : (0.0, 0.0, 0.0), ("palm_scaled_transverse", quadToQuadIntersectionBlockInstance.right0) : (0.0, 0.0, 0.0), ("forcefieldCenter", quadToQuadIntersectionBlockInstance.center1) : (0.0, 0.1, 0.0), ("forcefieldUp", quadToQuadIntersectionBlockInstance.up1) : (0.0, 0.1, 0.0), ("forcefieldRight", quadToQuadIntersectionBlockInstance.right1) : (0.1, 0.0, 0.0) }, output = linePathInstance.out, definedInVirtualSpace = True ) # ForcefieldLine IS strictly a Sensation-Producing Block # To avoid clutter in the Sensation-Producing Block menu, we only show the two-handed version 'Forcefield' (defined below) setMetaData(forcefieldBlock.out, "Sensation-Producing", False) setMetaData(forcefieldBlock.palm_position, "Input-Visibility", False) setMetaData(forcefieldBlock.palm_scaled_direction, "Input-Visibility", False) setMetaData(forcefieldBlock.palm_scaled_transverse, "Input-Visibility", False)
from pysensationcore import * import sensation_helpers as sh pathInstance = createInstance("CirclePath", "CirclePathInstance") palmTrackedCircle = sh.createSensationFromPath("PalmTrackedCircle", { ("radius", pathInstance.radius): (0.03, 0, 0), }, output=pathInstance.out, drawFrequency=60, renderMode=sh.RenderMode.Loop) setMetaData(palmTrackedCircle.radius, "Type", "Scalar")
from pysensationcore import * import sensation_helpers as sh import TriangleWave pathInstance = createInstance("CirclePath", "CirclePathInstance") triangleWaveBlockInstance = createInstance("TriangleWave", "triangleWave") connect(triangleWaveBlockInstance.out, pathInstance.radius) palmTrackedPulsingCircle = sh.createSensationFromPath("PalmTrackedPulsingCircle", { ("t", triangleWaveBlockInstance.t) : (0,0,0), ("Start Radius (m)", triangleWaveBlockInstance.minValue) : (0.01, 0, 0), ("End Radius (m)", triangleWaveBlockInstance.maxValue) : (0.05, 0, 0), ("Pulse Period (s)", triangleWaveBlockInstance.period) : (5.0, 0, 0), }, output = pathInstance.out, drawFrequency = 70, intensity = None, renderMode = sh.RenderMode.Loop ) setMetaData(palmTrackedPulsingCircle.__getattr__("Start Radius (m)"), "Type", "Scalar") setMetaData(palmTrackedPulsingCircle.__getattr__("End Radius (m)"), "Type", "Scalar") setMetaData(palmTrackedPulsingCircle.__getattr__("Pulse Period (s)"), "Type", "Scalar")
from pysensationcore import * import sensation_helpers as sh lissajousPath = createInstance("LissajousPath", "LissajousInstance") lissajous = sh.createSensationFromPath("LissajousSensation", { ("sizeX", lissajousPath.sizeX): (0.01, 0.0, 0.0), ("sizeY", lissajousPath.sizeY): (0.01, 0.0, 0.0), ("paramA", lissajousPath.paramA): (3.0, 0.0, 0.0), ("paramB", lissajousPath.paramB): (2.0, 0.0, 0.0) }, output=lissajousPath.out, drawFrequency=40, renderMode=sh.RenderMode.Loop) setMetaData(lissajous, "Allow-Transform", True) setMetaData(lissajous.sizeX, "Type", "Scalar") setMetaData(lissajous.sizeY, "Type", "Scalar") setMetaData(lissajous.paramA, "Type", "Scalar") setMetaData(lissajous.paramB, "Type", "Scalar")
# Inner blocks scan = createInstance("Scan", "scan") comparator = createInstance("Comparator", "ComparatorInstance") # Inner block connections connect(Constant((0, 0, 0)), comparator.returnValueIfAGreaterThanB) connect(Constant((1, 0, 0)), comparator.returnValueIfAEqualsB) connect(Constant((1, 0, 0)), comparator.returnValueIfALessThanB) handScan = sh.createSensationFromPath("HandScan", { ("t", scan.t): (0, 0, 0), ("duration", scan.duration): (2, 0, 0), ("barLength", scan.barLength): (0.1, 0, 0), ("virtualObjectXInVirtualSpace", scan.barDirection): (1, 0, 0), ("wrist_position", scan.animationPathStart): (0, 0.2, -0.06), ("middleFinger_distal_position", scan.animationPathEnd): (0, 0.2, 0.06), ("t", comparator.a): (0, 0, 0), ("duration", comparator.b): (2, 0, 0) }, output=scan.out, intensity=comparator.out, definedInVirtualSpace=True) setMetaData(handScan.virtualObjectXInVirtualSpace, "Input-Visibility", False) setMetaData(handScan.wrist_position, "Input-Visibility", False) setMetaData(handScan.middleFinger_distal_position, "Input-Visibility", False) setMetaData(handScan.duration, "Type", "Scalar") setMetaData(handScan.barLength, "Type", "Scalar")
# Inner blocks lerp = createInstance("Lerp", "lerp") circlePath = createInstance("CirclePath", "CirclePathInstance") comparator = createInstance("Comparator", "ComparatorInstance") # Inner block connections connect(lerp.out, circlePath.radius) connect(Constant((0, 0, 0)), lerp.y0) connect(Constant((0, 0, 0)), comparator.returnValueIfAGreaterThanB) connect(Constant((1, 0, 0)), comparator.returnValueIfAEqualsB) connect(Constant((1, 0, 0)), comparator.returnValueIfALessThanB) expandingCircle = sh.createSensationFromPath("ExpandingCircleSensation", { ("t", lerp.x): (0, 0, 0), ("duration", lerp.y1): (1, 0, 0), ("startRadius", lerp.x0): (0.01, 0, 0), ("endRadius", lerp.x1): (0.05, 0, 0), ("t", comparator.a): (0, 0, 0), ("duration", comparator.b): (1, 0, 0), }, output=circlePath.out, drawFrequency=70, intensity=comparator.out, renderMode=sh.RenderMode.Loop) setMetaData(expandingCircle, "Allow-Transform", True) setMetaData(expandingCircle.duration, "Type", "Scalar") setMetaData(expandingCircle.startRadius, "Type", "Scalar") setMetaData(expandingCircle.endRadius, "Type", "Scalar") setMetaData(expandingCircle.duration, "Type", "Scalar")