History

first try at angular-velocity setting action

Seth Alves committed 9 years ago

Commit 7f69bde1 parent 6808cf67 files · +49 −40Browse files

Showing the changes to libraries/physics/src/ObjectDynamic.cpp (1 of 7 files). Show all

Unified · Split

libraries/physics/src/ObjectDynamic.cpp+35−0
@@ -274,3 +274,38 @@ QList<btRigidBody*> ObjectDynamic::getRigidBodies() { · 273 unmodified lines
274274 result += getRigidBody();
275275 return result;
276276 }
277+
278+SpatiallyNestablePointer ObjectDynamic::getOther() {
279+ SpatiallyNestablePointer other;
280+ withWriteLock([&]{
281+ if (_otherID == QUuid()) {
282+ // no other
283+ return;
284+ }
285+ other = _other.lock();
286+ if (other && other->getID() == _otherID) {
287+ // other is already up-to-date
288+ return;
289+ }
290+ if (other) {
291+ // we have a pointer to other, but it's wrong
292+ other.reset();
293+ _other.reset();
294+ }
295+ // we have an other-id but no pointer to other cached
296+ QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
297+ if (!parentFinder) {
298+ return;
299+ }
300+ EntityItemPointer ownerEntity = _ownerEntity.lock();
301+ if (!ownerEntity) {
302+ return;
303+ }
304+ bool success;
305+ _other = parentFinder->find(_otherID, success, ownerEntity->getParentTree());
306+ if (success) {
307+ other = _other.lock();
308+ }
309+ });
310+ return other;
311+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t