mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
physics: Warn when copying PhysicalNode with physicals attached
We can't currently support this because a Physical can have only one PhysicalNode associated.
This commit is contained in:
parent
1c754738bd
commit
b6a118448d
@ -14,7 +14,11 @@
|
||||
#include "physicalNode.h"
|
||||
#include "physicsManager.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
// static stuff.
|
||||
static std::atomic_flag warned_copy_physical_node = ATOMIC_FLAG_INIT;
|
||||
|
||||
TypeHandle PhysicalNode::_type_handle;
|
||||
|
||||
/**
|
||||
@ -55,6 +59,12 @@ PhysicalNode::
|
||||
*/
|
||||
PandaNode *PhysicalNode::
|
||||
make_copy() const {
|
||||
if (!_physicals.empty() && !warned_copy_physical_node.test_and_set()) {
|
||||
// This is a problem, because a Physical can only be on one PhysicalNode.
|
||||
//FIXME: Figure out a solution.
|
||||
physics_cat.warning()
|
||||
<< "Detected attempt to copy PhysicalNode object with physicals.\n";
|
||||
}
|
||||
return new PhysicalNode(*this);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user