mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:43:31 +02:00
get sit points working
This commit is contained in:
parent
1663ff86d7
commit
314e299ba5
2 changed files with 14 additions and 5 deletions
|
@ -285,7 +285,7 @@ function update(deltaTime){
|
|||
avatarOldPosition = MyAvatar.position;
|
||||
|
||||
var SEARCH_RADIUS = 50;
|
||||
var foundModels = Models.findModels(MyAvatar.position, SEARCH_RADIUS);
|
||||
var foundModels = Entities.findEntities(MyAvatar.position, SEARCH_RADIUS);
|
||||
// Let's remove indicator that got out of radius
|
||||
for (model in models) {
|
||||
if (Vec3.distance(models[model].properties.position, MyAvatar.position) > SEARCH_RADIUS) {
|
||||
|
@ -297,7 +297,7 @@ function update(deltaTime){
|
|||
for (var i = 0; i < foundModels.length; ++i) {
|
||||
var model = foundModels[i];
|
||||
if (typeof(models[model.id]) == "undefined") {
|
||||
model.properties = Models.getModelProperties(model);
|
||||
model.properties = Entities.getEntityProperties(model);
|
||||
if (Vec3.distance(model.properties.position, MyAvatar.position) < SEARCH_RADIUS) {
|
||||
addIndicators(model);
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ function addIndicators(modelID) {
|
|||
|
||||
models[modelID.id] = modelID;
|
||||
} else {
|
||||
Models.editModel(modelID, { glowLevel: 0.0 });
|
||||
Entities.editEntity(modelID, { glowLevel: 0.0 });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "EntityScriptingInterface.h"
|
||||
#include "EntityTree.h"
|
||||
#include "ModelEntityItem.h"
|
||||
|
||||
EntityScriptingInterface::EntityScriptingInterface() :
|
||||
_nextCreatorTokenID(0),
|
||||
|
@ -75,10 +76,18 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID
|
|||
if (_entityTree) {
|
||||
_entityTree->lockForRead();
|
||||
EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(identity));
|
||||
|
||||
if (entity) {
|
||||
|
||||
// TODO: look into sitting points!!!
|
||||
//entity->setSittingPoints(_entityTree->getGeometryForEntity(entity)->sittingPoints);
|
||||
// TODO: improve sitting points in the future, for now we've included the old model behavior for entity
|
||||
// types that are models
|
||||
if (entity->getType() == EntityTypes::Model) {
|
||||
ModelEntityItem* model = dynamic_cast<ModelEntityItem*>(entity);
|
||||
const FBXGeometry* geometry = _entityTree->getGeometryForEntity(entity);
|
||||
if (geometry) {
|
||||
model->setSittingPoints(geometry->sittingPoints);
|
||||
}
|
||||
}
|
||||
|
||||
results = entity->getProperties();
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue