Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 44 files). Show all
Unified · Split
| @@ -2268,3 +2268,126 @@ bool EntityScriptingInterface::verifyStaticCertificateProperties(const QUuid& en · 2267 unmodified lines | |||
| 2268 | } | 2268 | } |
| 2269 | return result; | 2269 | return result; |
| 2270 | } | 2270 | } |
| 2271 | |||
| 2272 | glm::vec3 EntityScriptingInterface::worldToLocalPosition(glm::vec3 worldPosition, const QUuid& parentID, | ||
| 2273 | int parentJointIndex, bool scalesWithParent) { | ||
| 2274 | bool success; | ||
| 2275 | glm::vec3 localPosition = SpatiallyNestable::worldToLocal(worldPosition, parentID, parentJointIndex, | ||
| 2276 | scalesWithParent, success); | ||
| 2277 | if (success) { | ||
| 2278 | return localPosition; | ||
| 2279 | } else { | ||
| 2280 | return glm::vec3(0.0f); | ||
| 2281 | } | ||
| 2282 | } | ||
| 2283 | |||
| 2284 | glm::quat EntityScriptingInterface::worldToLocalRotation(glm::quat worldRotation, const QUuid& parentID, | ||
| 2285 | int parentJointIndex, bool scalesWithParent) { | ||
| 2286 | bool success; | ||
| 2287 | glm::quat localRotation = SpatiallyNestable::worldToLocal(worldRotation, parentID, parentJointIndex, | ||
| 2288 | scalesWithParent, success); | ||
| 2289 | if (success) { | ||
| 2290 | return localRotation; | ||
| 2291 | } else { | ||
| 2292 | return glm::quat(); | ||
| 2293 | } | ||
| 2294 | } | ||
| 2295 | |||
| 2296 | glm::vec3 EntityScriptingInterface::worldToLocalVelocity(glm::vec3 worldVelocity, const QUuid& parentID, | ||
| 2297 | int parentJointIndex, bool scalesWithParent) { | ||
| 2298 | bool success; | ||
| 2299 | glm::vec3 localVelocity = SpatiallyNestable::worldToLocalVelocity(worldVelocity, parentID, parentJointIndex, | ||
| 2300 | scalesWithParent, success); | ||
| 2301 | if (success) { | ||
| 2302 | return localVelocity; | ||
| 2303 | } else { | ||
| 2304 | return glm::vec3(0.0f); | ||
| 2305 | } | ||
| 2306 | } | ||
| 2307 | |||
| 2308 | glm::vec3 EntityScriptingInterface::worldToLocalAngularVelocity(glm::vec3 worldAngularVelocity, const QUuid& parentID, | ||
| 2309 | int parentJointIndex, bool scalesWithParent) { | ||
| 2310 | bool success; | ||
| 2311 | glm::vec3 localAngularVelocity = SpatiallyNestable::worldToLocalAngularVelocity(worldAngularVelocity, parentID, | ||
| 2312 | parentJointIndex, scalesWithParent, | ||
| 2313 | success); | ||
| 2314 | if (success) { | ||
| 2315 | return localAngularVelocity; | ||
| 2316 | } else { | ||
| 2317 | return glm::vec3(0.0f); | ||
| 2318 | } | ||
| 2319 | } | ||
| 2320 | |||
| 2321 | glm::vec3 EntityScriptingInterface::worldToLocalDimensions(glm::vec3 worldDimensions, const QUuid& parentID, | ||
| 2322 | int parentJointIndex, bool scalesWithParent) { | ||
| 2323 | |||
| 2324 | bool success; | ||
| 2325 | glm::vec3 localDimensions = SpatiallyNestable::worldToLocalDimensions(worldDimensions, parentID, parentJointIndex, | ||
| 2326 | scalesWithParent, success); | ||
| 2327 | if (success) { | ||
| 2328 | return localDimensions; | ||
| 2329 | } else { | ||
| 2330 | return glm::vec3(0.0f); | ||
| 2331 | } | ||
| 2332 | } | ||
| 2333 | |||
| 2334 | glm::vec3 EntityScriptingInterface::localToWorldPosition(glm::vec3 localPosition, const QUuid& parentID, | ||
| 2335 | int parentJointIndex, bool scalesWithParent) { | ||
| 2336 | bool success; | ||
| 2337 | glm::vec3 worldPosition = SpatiallyNestable::localToWorld(localPosition, parentID, parentJointIndex, | ||
| 2338 | scalesWithParent, success); | ||
| 2339 | if (success) { | ||
| 2340 | return worldPosition; | ||
| 2341 | } else { | ||
| 2342 | return glm::vec3(0.0f); | ||
| 2343 | } | ||
| 2344 | } | ||
| 2345 | |||
| 2346 | glm::quat EntityScriptingInterface::localToWorldRotation(glm::quat localRotation, const QUuid& parentID, | ||
| 2347 | int parentJointIndex, bool scalesWithParent) { | ||
| 2348 | bool success; | ||
| 2349 | glm::quat worldRotation = SpatiallyNestable::localToWorld(localRotation, parentID, parentJointIndex, | ||
| 2350 | scalesWithParent, success); | ||
| 2351 | if (success) { | ||
| 2352 | return worldRotation; | ||
| 2353 | } else { | ||
| 2354 | return glm::quat(); | ||
| 2355 | } | ||
| 2356 | } | ||
| 2357 | |||
| 2358 | glm::vec3 EntityScriptingInterface::localToWorldVelocity(glm::vec3 localVelocity, const QUuid& parentID, | ||
| 2359 | int parentJointIndex, bool scalesWithParent) { | ||
| 2360 | bool success; | ||
| 2361 | glm::vec3 worldVelocity = SpatiallyNestable::localToWorldVelocity(localVelocity, parentID, parentJointIndex, | ||
| 2362 | scalesWithParent, success); | ||
| 2363 | if (success) { | ||
| 2364 | return worldVelocity; | ||
| 2365 | } else { | ||
| 2366 | return glm::vec3(0.0f); | ||
| 2367 | } | ||
| 2368 | } | ||
| 2369 | |||
| 2370 | glm::vec3 EntityScriptingInterface::localToWorldAngularVelocity(glm::vec3 localAngularVelocity, const QUuid& parentID, | ||
| 2371 | int parentJointIndex, bool scalesWithParent) { | ||
| 2372 | bool success; | ||
| 2373 | glm::vec3 worldAngularVelocity = SpatiallyNestable::localToWorldAngularVelocity(localAngularVelocity, | ||
| 2374 | parentID, parentJointIndex, | ||
| 2375 | scalesWithParent, success); | ||
| 2376 | if (success) { | ||
| 2377 | return worldAngularVelocity; | ||
| 2378 | } else { | ||
| 2379 | return glm::vec3(0.0f); | ||
| 2380 | } | ||
| 2381 | } | ||
| 2382 | |||
| 2383 | glm::vec3 EntityScriptingInterface::localToWorldDimensions(glm::vec3 localDimensions, const QUuid& parentID, | ||
| 2384 | int parentJointIndex, bool scalesWithParent) { | ||
| 2385 | bool success; | ||
| 2386 | glm::vec3 worldDimensions = SpatiallyNestable::localToWorldDimensions(localDimensions, parentID, parentJointIndex, | ||
| 2387 | scalesWithParent, success); | ||
| 2388 | if (success) { | ||
| 2389 | return worldDimensions; | ||
| 2390 | } else { | ||
| 2391 | return glm::vec3(0.0f); | ||
| 2392 | } | ||
| 2393 | } | ||