Allow moving library object with physical body
This commit is contained in:
parent
725d587566
commit
1ee2f01fbc
@ -706,24 +706,11 @@ void TrackObject::addChild(TrackObject* child)
|
||||
// scripting function
|
||||
void TrackObject::moveTo(const Scripting::SimpleVec3* pos, bool isAbsoluteCoord)
|
||||
{
|
||||
TrackObjectPresentationLibraryNode *libnode =
|
||||
dynamic_cast<TrackObjectPresentationLibraryNode*>(m_presentation);
|
||||
if (libnode != NULL)
|
||||
{
|
||||
libnode->move(core::vector3df(pos->getX(), pos->getY(), pos->getZ()),
|
||||
core::vector3df(0.0f, 0.0f, 0.0f), // TODO: preserve rotation
|
||||
core::vector3df(1.0f, 1.0f, 1.0f), // TODO: preserve scale
|
||||
isAbsoluteCoord,
|
||||
true /* moveChildrenPhysicalBodies */);
|
||||
}
|
||||
else
|
||||
{
|
||||
move(core::vector3df(pos->getX(), pos->getY(), pos->getZ()),
|
||||
core::vector3df(0.0f, 0.0f, 0.0f), // TODO: preserve rotation
|
||||
core::vector3df(1.0f, 1.0f, 1.0f), // TODO: preserve scale
|
||||
true, // updateRigidBody
|
||||
isAbsoluteCoord);
|
||||
}
|
||||
move(core::vector3df(pos->getX(), pos->getY(), pos->getZ()),
|
||||
core::vector3df(0.0f, 0.0f, 0.0f), // TODO: preserve rotation
|
||||
core::vector3df(1.0f, 1.0f, 1.0f), // TODO: preserve scale
|
||||
true, // updateRigidBody
|
||||
isAbsoluteCoord);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -332,19 +332,15 @@ TrackObjectPresentationLibraryNode::~TrackObjectPresentationLibraryNode()
|
||||
} // TrackObjectPresentationLibraryNode
|
||||
// ----------------------------------------------------------------------------
|
||||
void TrackObjectPresentationLibraryNode::move(const core::vector3df& xyz, const core::vector3df& hpr,
|
||||
const core::vector3df& scale, bool isAbsoluteCoord, bool moveChildrenPhysicalBodies)
|
||||
const core::vector3df& scale, bool isAbsoluteCoord)
|
||||
{
|
||||
TrackObjectPresentationSceneNode::move(xyz, hpr, scale, isAbsoluteCoord);
|
||||
|
||||
if (moveChildrenPhysicalBodies)
|
||||
for (TrackObject* obj : m_parent->getChildren())
|
||||
{
|
||||
for (TrackObject* obj : m_parent->getChildren())
|
||||
if (obj->getPhysicalObject() != NULL)
|
||||
{
|
||||
obj->reset();
|
||||
if (obj->getPhysicalObject() != NULL)
|
||||
{
|
||||
obj->movePhysicalBodyToGraphicalNode(obj->getAbsolutePosition(), obj->getRotation());
|
||||
}
|
||||
obj->movePhysicalBodyToGraphicalNode(obj->getAbsolutePosition(), obj->getRotation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ public:
|
||||
m_reset_executed = false;
|
||||
TrackObjectPresentationSceneNode::reset();
|
||||
}
|
||||
void move(const core::vector3df& xyz, const core::vector3df& hpr,
|
||||
const core::vector3df& scale, bool isAbsoluteCoord, bool moveChildrenPhysicalBodies);
|
||||
virtual void move(const core::vector3df& xyz, const core::vector3df& hpr,
|
||||
const core::vector3df& scale, bool isAbsoluteCoord) OVERRIDE;
|
||||
}; // TrackObjectPresentationLibraryNode
|
||||
|
||||
// ============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user