mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
some debugging on Andrew's refactor
This commit is contained in:
parent
c9f97b9d42
commit
c35edd8eb4
6 changed files with 18 additions and 10 deletions
|
@ -86,10 +86,14 @@ void RenderableDebugableEntityItem::render(EntityItem* entity, RenderArgs* args)
|
|||
|
||||
glm::vec3 position;
|
||||
glm::quat rotation;
|
||||
if (PhysicsEngine::getBodyLocation(entity->getPhysicsInfo(), position, rotation)) {
|
||||
glm::vec3 positionOffset = glm::abs(position - entity->getPosition());
|
||||
if (positionOffset[0] > 0.001 || positionOffset[1] > 0.001 || positionOffset[2] > 0.001) {
|
||||
qDebug() << positionOffset[0] << positionOffset[1] << positionOffset[2];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// XXX for future debugging
|
||||
//
|
||||
// if (PhysicsEngine::getBodyLocation(entity->getPhysicsInfo(), position, rotation)) {
|
||||
// glm::vec3 positionOffset = glm::abs(position - entity->getPosition());
|
||||
// if (positionOffset[0] > 0.001 || positionOffset[1] > 0.001 || positionOffset[2] > 0.001) {
|
||||
// qDebug() << positionOffset[0] << positionOffset[1] << positionOffset[2];
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1189,6 +1189,7 @@ void EntityItem::updateVelocity(const glm::vec3& value) {
|
|||
_velocity = value;
|
||||
}
|
||||
_dirtyFlags |= EntityItem::DIRTY_LINEAR_VELOCITY;
|
||||
_dirtyFlags |= EntityItem::DIRTY_PHYSICS_ACTIVATION;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1221,6 +1222,7 @@ void EntityItem::updateAngularVelocity(const glm::vec3& value) {
|
|||
auto distance = glm::distance(_angularVelocity, value);
|
||||
if (distance > MIN_SPIN_DELTA) {
|
||||
_dirtyFlags |= EntityItem::DIRTY_ANGULAR_VELOCITY;
|
||||
_dirtyFlags |= EntityItem::DIRTY_PHYSICS_ACTIVATION;
|
||||
if (glm::length(value) < MIN_SPIN_DELTA) {
|
||||
_angularVelocity = ENTITY_ITEM_ZERO_VEC3;
|
||||
} else {
|
||||
|
|
|
@ -48,7 +48,6 @@ void EntitySimulation::getEntitiesToDelete(VectorOfEntities& entitiesToDelete) {
|
|||
}
|
||||
|
||||
void EntitySimulation::addEntityInternal(EntityItem* entity) {
|
||||
entity->_simulated = true;
|
||||
if (entity->isMoving() && !entity->getPhysicsInfo()) {
|
||||
_simpleKinematicEntities.insert(entity);
|
||||
}
|
||||
|
@ -154,6 +153,7 @@ void EntitySimulation::addEntity(EntityItem* entity) {
|
|||
_entitiesToUpdate.insert(entity);
|
||||
}
|
||||
addEntityInternal(entity);
|
||||
entity->_simulated = true;
|
||||
|
||||
// DirtyFlags are used to signal changes to entities that have already been added,
|
||||
// so we can clear them for this entity which has just been added.
|
||||
|
|
|
@ -159,7 +159,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro
|
|||
|
||||
uint32_t newFlags = entity->getDirtyFlags() & ~preFlags;
|
||||
if (newFlags) {
|
||||
if (_simulation) {
|
||||
if (_simulation) {
|
||||
if (newFlags & DIRTY_SIMULATION_FLAGS) {
|
||||
_simulation->lock();
|
||||
_simulation->changeEntity(entity);
|
||||
|
|
|
@ -393,7 +393,8 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
|||
uint32_t EntityMotionState::getIncomingDirtyFlags() const {
|
||||
uint32_t dirtyFlags = 0;
|
||||
if (_body && _entity) {
|
||||
_entity->getDirtyFlags();
|
||||
dirtyFlags = _entity->getDirtyFlags();
|
||||
_entity->clearDirtyFlags();
|
||||
// we add DIRTY_MOTION_TYPE if the body's motion type disagrees with entity velocity settings
|
||||
int bodyFlags = _body->getCollisionFlags();
|
||||
bool isMoving = _entity->isMoving();
|
||||
|
|
|
@ -36,7 +36,8 @@ enum MotionStateType {
|
|||
// and re-added to the physics engine and "easy" which just updates the body properties.
|
||||
const uint32_t HARD_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_MOTION_TYPE | EntityItem::DIRTY_SHAPE);
|
||||
const uint32_t EASY_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_TRANSFORM | EntityItem::DIRTY_VELOCITIES |
|
||||
EntityItem::DIRTY_MASS | EntityItem::DIRTY_COLLISION_GROUP | EntityItem::DIRTY_MATERIAL);
|
||||
EntityItem::DIRTY_MASS | EntityItem::DIRTY_COLLISION_GROUP |
|
||||
EntityItem::DIRTY_MATERIAL | EntityItem::DIRTY_PHYSICS_ACTIVATION);
|
||||
|
||||
// These are the set of incoming flags that the PhysicsEngine needs to hear about:
|
||||
const uint32_t DIRTY_PHYSICS_FLAGS = HARD_DIRTY_PHYSICS_FLAGS | EASY_DIRTY_PHYSICS_FLAGS;
|
||||
|
|
Loading…
Reference in a new issue