History

moving the hydra grab behavior to JS

ZappoMan committed 12 years ago

Commit 991c7201 parent 3f73b6111 files · +132 −68Browse files

Showing the changes to interface/src/ControllerScriptingInterface.cpp (1 of 11 files). Show all

Unified · Split

interface/src/ControllerScriptingInterface.cpp+15−0
@@ -172,6 +172,21 @@ glm::vec3 ControllerScriptingInterface::getSpatialControlVelocity(int controlInd · 171 unmodified lines
172172 return glm::vec3(0); // bad index
173173 }
174174
175+glm::quat ControllerScriptingInterface::getSpatialControlRawRotation(int controlIndex) const {
176+ int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM;
177+ int controlOfPalm = controlIndex % NUMBER_OF_SPATIALCONTROLS_PER_PALM;
178+ const PalmData* palmData = getActivePalm(palmIndex);
179+ if (palmData) {
180+ switch (controlOfPalm) {
181+ case PALM_SPATIALCONTROL:
182+ return palmData->getRawRotation();
183+ case TIP_SPATIALCONTROL:
184+ return palmData->getRawRotation(); // currently the tip doesn't have a unique rotation, use the palm rotation
185+ }
186+ }
187+ return glm::quat(); // bad index
188+}
189+
175190 glm::vec3 ControllerScriptingInterface::getSpatialControlNormal(int controlIndex) const {
176191 int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM;
177192 int controlOfPalm = controlIndex % NUMBER_OF_SPATIALCONTROLS_PER_PALM;