-
Objective is the same as PhysX shift-origin, context is also NOT robotics. The objective is to translate everything by vector without reconstructing anything or shifting each object individually and resolving the consequences of the shift for each object's shift individually. Instead translating the entirety of the simulation without changing it's tree. The wake/sleep states of all shifted objects should remain the same as they were before the shift. From what I can tell (when using Dbvt) there should be nothing wrong with walking the tree and shifting the min/max of the nodes and then doing the appropriate offsets for btSoftBody and btCollisionObject. Everything else (contacts, joints, etc) appears to be in one local space or another. Is this a safe assumption? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This appears to hold true at least for a trivial scene of a stack of boxes and ragdolls. Constraints and contacts all appear correct through shifts. void btDbvtNode::offset(const btVector3& ofs)
{
volume.offset(ofs);
if (isinternal())
{
childs[0]->offset(ofs);
childs[1]->offset(ofs);
}
else
{
if (auto prox = (btDbvtProxy*)data)
{
if (auto obj = ((btCollisionObject*)prox->m_clientObject))
{
if (obj->getInternalType() == btCollisionObject::CO_SOFT_BODY)
{
auto softBody = ((btSoftBody*)obj);
auto transform = softBody->getWorldTransform();
auto origin = transform.getOrigin() + ofs;
transform.setOrigin(origin);
obj->setWorldTransform(transform);
}
else if (obj->getInternalType() == btCollisionObject::CO_RIGID_BODY)
{
auto transform = obj->getWorldTransform();
auto origin = transform.getOrigin() + ofs;
transform.setOrigin(origin);
obj->setWorldTransform(transform);
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
recently I did the inverse of this
I actually shift a terrain mesh periodically on a grid -> with the
terrain marked dynamic, and set it's linV to 0 and all the objects sit in
place
sort of like pulling a tablecloth out from a bunch of stuff and it staying
https://www.youtube.com/watch?v=UPC2uJVLSh0
…On Sun, Aug 29, 2021 at 7:20 PM Jonathan Sandusky ***@***.***> wrote:
This appears to hold true at least for a trivial scene of a stack of boxes
and ragdolls. Constraints and contacts all appear correct through shifts.
void btDbvtNode::offset(const btVector3& ofs)
{
volume.offset(ofs);
if (isinternal())
{
childs[0]->offset(ofs);
childs[1]->offset(ofs);
}
else
{
if (auto prox = (btDbvtProxy*)data)
{
if (auto obj = ((btCollisionObject*)prox->m_clientObject))
{
if (obj->getInternalType() == btCollisionObject::CO_SOFT_BODY)
{
auto softBody = ((btSoftBody*)obj);
auto transform = softBody->getWorldTransform();
auto origin = transform.getOrigin() + ofs;
transform.setOrigin(origin);
obj->setWorldTransform(transform);
}
else if (obj->getInternalType() == btCollisionObject::CO_RIGID_BODY)
{
auto transform = obj->getWorldTransform();
auto origin = transform.getOrigin() + ofs;
transform.setOrigin(origin);
obj->setWorldTransform(transform);
}
}
}
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3947 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABW3SWPEC2TCN3EUV6CH3GTT7LTF5ANCNFSM5C7YJ5SA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
This appears to hold true at least for a trivial scene of a stack of boxes and ragdolls. Constraints and contacts all appear correct through shifts.