|
@@ -107,6 +107,7 @@ void RigidBody::getWorldTransform(btTransform &worldTrans) const
|
|
|
|
|
|
|
|
void RigidBody::setWorldTransform(const btTransform &worldTrans)
|
|
void RigidBody::setWorldTransform(const btTransform &worldTrans)
|
|
|
{
|
|
{
|
|
|
|
|
+ /// \todo If rigid body is parented, should set the transforms in hierarchy order (parent first)
|
|
|
if (node_)
|
|
if (node_)
|
|
|
{
|
|
{
|
|
|
inSetTransform_ = true;
|
|
inSetTransform_ = true;
|
|
@@ -567,18 +568,25 @@ void RigidBody::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
|
|
|
|
|
|
|
|
void RigidBody::OnMarkedDirty(Node* node)
|
|
void RigidBody::OnMarkedDirty(Node* node)
|
|
|
{
|
|
{
|
|
|
- // Physics operations are not safe from worker threads
|
|
|
|
|
- Scene* scene = node->GetScene();
|
|
|
|
|
- if (scene && scene->IsThreadedUpdate())
|
|
|
|
|
|
|
+ /// \todo If the node contains a SmoothedTransform component, do not react to dirtying, but rather update the position elsewhere
|
|
|
|
|
+ if (!inSetTransform_)
|
|
|
{
|
|
{
|
|
|
- scene->DelayedMarkedDirty(this);
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ // Physics operations are not safe from worker threads
|
|
|
|
|
+ Scene* scene = node->GetScene();
|
|
|
|
|
+ if (scene && scene->IsThreadedUpdate())
|
|
|
|
|
+ {
|
|
|
|
|
+ scene->DelayedMarkedDirty(this);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Vector3 newWorldPos = node_->GetWorldPosition();
|
|
|
|
|
+ Quaternion newWorldRot = node_->GetWorldRotation();
|
|
|
|
|
+
|
|
|
|
|
+ if (newWorldPos != GetPosition())
|
|
|
|
|
+ SetPosition(newWorldPos);
|
|
|
|
|
+ if (newWorldRot != GetRotation())
|
|
|
|
|
+ SetRotation(newWorldRot);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /// \todo If the node contains a SmoothedTransform component, do not react to dirtying, but rather update the position elsewhere
|
|
|
|
|
-
|
|
|
|
|
- SetPosition(node_->GetWorldPosition());
|
|
|
|
|
- SetRotation(node_->GetWorldRotation());
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void RigidBody::OnNodeSet(Node* node)
|
|
void RigidBody::OnNodeSet(Node* node)
|