mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:00:13 +02:00
work on moving dancers to center of table if it's present
This commit is contained in:
parent
10585a1b30
commit
ebeedb5cde
2 changed files with 66 additions and 5 deletions
|
@ -50,7 +50,8 @@
|
||||||
// remember we're being grabbed so we can detect being released
|
// remember we're being grabbed so we can detect being released
|
||||||
_this.beingGrabbed = true;
|
_this.beingGrabbed = true;
|
||||||
var props = Entities.getEntityProperties(entityID);
|
var props = Entities.getEntityProperties(entityID);
|
||||||
breakdanceStart(props.modelURL, props.position);
|
var puppetPosition = getPuppetPosition(props);
|
||||||
|
breakdanceStart(props.modelURL, puppetPosition);
|
||||||
print("I'm was grabbed...");
|
print("I'm was grabbed...");
|
||||||
} else {
|
} else {
|
||||||
breakdanceUpdate();
|
breakdanceUpdate();
|
||||||
|
|
|
@ -11,7 +11,63 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
function getPositionPuppet() {
|
function getPuppetPosition(props) {
|
||||||
|
print ("getPuppetPosition...");
|
||||||
|
var MAX_DISTANCE = 10;
|
||||||
|
var searchPosition = MyAvatar.position;
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: A" );
|
||||||
|
|
||||||
|
if (props !== undefined && props.position !== undefined) {
|
||||||
|
searchPosition = props.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: B");
|
||||||
|
|
||||||
|
// first look for the "Table 1" entity
|
||||||
|
Vec3.print("searchPosition:", searchPosition);
|
||||||
|
|
||||||
|
var ids = Entities.findEntities(searchPosition, MAX_DISTANCE);
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: C");
|
||||||
|
print("ids:"+ ids.toString());
|
||||||
|
|
||||||
|
for (var i in ids) {
|
||||||
|
|
||||||
|
print("i:"+ i);
|
||||||
|
var entityId = ids[i];
|
||||||
|
|
||||||
|
print ("findEntities entityId:" + entityId);
|
||||||
|
|
||||||
|
var foundProps = Entities.getEntityProperties(entityId);
|
||||||
|
print ("foundProps.name:" + foundProps.name);
|
||||||
|
|
||||||
|
if (foundProps.name == "Table 1") {
|
||||||
|
Vec3.print("foundProps.center:", foundProps.boundingBox.center);
|
||||||
|
|
||||||
|
position = foundProps.boundingBox.center;
|
||||||
|
|
||||||
|
position.y += foundProps.boundingBox.dimensions.y / 2;
|
||||||
|
|
||||||
|
Vec3.print("found table 1 center, position:", position);
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: D");
|
||||||
|
|
||||||
|
Vec3.print("found table 1 center, position:", position);
|
||||||
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: E");
|
||||||
|
|
||||||
|
if (props !== undefined && props.position !== undefined) {
|
||||||
|
Vec3.print("props.position:", props.position);
|
||||||
|
return props.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: F");
|
||||||
|
|
||||||
var DISTANCE_IN_FRONT = 2;
|
var DISTANCE_IN_FRONT = 2;
|
||||||
var DISTANCE_UP = 0.4;
|
var DISTANCE_UP = 0.4;
|
||||||
var DISTANCE_TO_SIDE = 0.0;
|
var DISTANCE_TO_SIDE = 0.0;
|
||||||
|
@ -27,11 +83,14 @@ function getPositionPuppet() {
|
||||||
|
|
||||||
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), upOffset);
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), upOffset);
|
||||||
var position = Vec3.sum(MyAvatar.position, offset);
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
|
||||||
|
Vec3.print("default, position:", position);
|
||||||
|
|
||||||
|
print ("getPuppetPosition... line: G");
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getPositionLeftFront() {
|
function getPositionLeftFront() {
|
||||||
var DISTANCE_IN_FRONT = 0.6;
|
var DISTANCE_IN_FRONT = 0.6;
|
||||||
var DISTANCE_UP = 0.4;
|
var DISTANCE_UP = 0.4;
|
||||||
|
@ -363,11 +422,12 @@ function createPuppet(model, location) {
|
||||||
model = "https://hifi-public.s3.amazonaws.com/models/Bboys/bboy1/bboy1.fbx";
|
model = "https://hifi-public.s3.amazonaws.com/models/Bboys/bboy1/bboy1.fbx";
|
||||||
}
|
}
|
||||||
if (location == undefined) {
|
if (location == undefined) {
|
||||||
location = getPositionPuppet();
|
location = getPuppetPosition();
|
||||||
}
|
}
|
||||||
puppetEntityID = Entities.addEntity({
|
puppetEntityID = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: model,
|
modelURL: model,
|
||||||
|
registrationPoint: { x: 0.5, y: 0, z: 0.5 },
|
||||||
animationURL: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx",
|
animationURL: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx",
|
||||||
animationSettings: ANIMATION_SETTINGS,
|
animationSettings: ANIMATION_SETTINGS,
|
||||||
position: location,
|
position: location,
|
||||||
|
|
Loading…
Reference in a new issue