local entities are always collisionless

This commit is contained in:
SamGondelman 2018-11-14 14:48:07 -08:00
parent 079d1dcbd6
commit 8dbb2d806b
2 changed files with 16 additions and 2 deletions

View file

@ -3977,7 +3977,13 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID
setParentJointIndex(-1);
setLifetime(getCloneLifetime());
setDynamic(getCloneDynamic());
setEntityHost(getCloneAvatarEntity() ? EntityHost::AVATAR_ENTITY : EntityHost::DOMAIN_ENTITY);
if (getEntityHost() != EntityHost::LOCAL_ENTITY) {
setEntityHost(getCloneAvatarEntity() ? EntityHost::AVATAR_ENTITY : EntityHost::DOMAIN_ENTITY);
} else {
// Local Entities clone as local entities
setEntityHost(EntityHost::LOCAL_ENTITY);
setCollisionless(true);
}
setCreated(usecTimestampNow());
setLastEdited(usecTimestampNow());
setCloneable(ENTITY_ITEM_DEFAULT_CLONEABLE);

View file

@ -482,6 +482,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
propertiesWithSimID.setEntityHostFromString(entityHostString);
if (propertiesWithSimID.getEntityHost() == EntityHost::AVATAR_ENTITY) {
propertiesWithSimID.setOwningAvatarID(sessionID);
} else if (propertiesWithSimID.getEntityHost() == EntityHost::LOCAL_ENTITY) {
// For now, local entities are always collisionless
// TODO: create a separate, local physics simulation that just handles local entities (and MyAvatar?)
propertiesWithSimID.setCollisionless(true);
}
propertiesWithSimID.setLastEditedBy(sessionID);
@ -834,7 +838,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
}
// set these to make EntityItemProperties::getScalesWithParent() work correctly
properties.setEntityHost(entity->getEntityHost());
EntityHost entityHost = entity->getEntityHost();
properties.setEntityHost(entityHost);
if (entityHost == EntityHost::LOCAL_ENTITY) {
properties.setCollisionless(true);
}
properties.setOwningAvatarID(entity->getOwningAvatarID());
// make sure the properties has a type, so that the encode can know which properties to include