mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:36:56 +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;
|
avatarOldPosition = MyAvatar.position;
|
||||||
|
|
||||||
var SEARCH_RADIUS = 50;
|
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
|
// Let's remove indicator that got out of radius
|
||||||
for (model in models) {
|
for (model in models) {
|
||||||
if (Vec3.distance(models[model].properties.position, MyAvatar.position) > SEARCH_RADIUS) {
|
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) {
|
for (var i = 0; i < foundModels.length; ++i) {
|
||||||
var model = foundModels[i];
|
var model = foundModels[i];
|
||||||
if (typeof(models[model.id]) == "undefined") {
|
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) {
|
if (Vec3.distance(model.properties.position, MyAvatar.position) < SEARCH_RADIUS) {
|
||||||
addIndicators(model);
|
addIndicators(model);
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ function addIndicators(modelID) {
|
||||||
|
|
||||||
models[modelID.id] = modelID;
|
models[modelID.id] = modelID;
|
||||||
} else {
|
} else {
|
||||||
Models.editModel(modelID, { glowLevel: 0.0 });
|
Entities.editEntity(modelID, { glowLevel: 0.0 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "EntityScriptingInterface.h"
|
#include "EntityScriptingInterface.h"
|
||||||
#include "EntityTree.h"
|
#include "EntityTree.h"
|
||||||
|
#include "ModelEntityItem.h"
|
||||||
|
|
||||||
EntityScriptingInterface::EntityScriptingInterface() :
|
EntityScriptingInterface::EntityScriptingInterface() :
|
||||||
_nextCreatorTokenID(0),
|
_nextCreatorTokenID(0),
|
||||||
|
@ -75,10 +76,18 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID
|
||||||
if (_entityTree) {
|
if (_entityTree) {
|
||||||
_entityTree->lockForRead();
|
_entityTree->lockForRead();
|
||||||
EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(identity));
|
EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(identity));
|
||||||
|
|
||||||
if (entity) {
|
if (entity) {
|
||||||
|
|
||||||
// TODO: look into sitting points!!!
|
// TODO: improve sitting points in the future, for now we've included the old model behavior for entity
|
||||||
//entity->setSittingPoints(_entityTree->getGeometryForEntity(entity)->sittingPoints);
|
// 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();
|
results = entity->getProperties();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue