History

add angularVelocity to controller

Philip Rosedale committed 11 years ago

Commit d74856e1 parent af99a5d5 files · +32 −2Browse files

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

Unified · Split

interface/src/scripting/ControllerScriptingInterface.cpp+15−0
@@ -208,6 +208,21 @@ glm::quat ControllerScriptingInterface::getSpatialControlRawRotation(int control · 207 unmodified lines
208 }208 }
209 return glm::quat(); // bad index209 return glm::quat(); // bad index
210}210}
211
212glm::vec3 ControllerScriptingInterface::getSpatialControlRawAngularVelocity(int controlIndex) const {
213 int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM;
214 int controlOfPalm = controlIndex % NUMBER_OF_SPATIALCONTROLS_PER_PALM;
215 const PalmData* palmData = getActivePalm(palmIndex);
216 if (palmData) {
217 switch (controlOfPalm) {
218 case PALM_SPATIALCONTROL:
219 return palmData->getRawAngularVelocity();
220 case TIP_SPATIALCONTROL:
221 return palmData->getRawAngularVelocity(); // Tip = palm angular velocity
222 }
223 }
224 return glm::vec3(0); // bad index
225}
211 226
212glm::vec3 ControllerScriptingInterface::getSpatialControlNormal(int controlIndex) const {227glm::vec3 ControllerScriptingInterface::getSpatialControlNormal(int controlIndex) const {
213 int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM;228 int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM;