You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same code works reasonably well in Interface, so maybe Assignment Client is doing something wrong?
Only position will be sent in such case and user is not warned at all:
int maximumByteArraySize = NLPacket::maxPayloadSize(PacketType::AvatarData) - sizeof(AvatarDataSequenceNumber);
if (avatarByteArray.size() > maximumByteArraySize) {
avatarByteArray = toByteArrayStateful(dataDetail, true);
if (avatarByteArray.size() > maximumByteArraySize) {
avatarByteArray = toByteArrayStateful(MinimumData, true);
if (avatarByteArray.size() > maximumByteArraySize) {
qCWarning(avatars) << "toByteArrayStateful() MinimumData resulted in very large buffer:" << avatarByteArray.size() << "... FAIL!!";
return 0;
}
}
}
Maybe instead data could be split over several packets?
Surprising part is that Interface deals pretty well with same avatars that don't work on Agent.
Example of broken Agent script:
//
// simpleBot.js
// examples
//
// Created by Brad Hefta-Gaub on 12/23/16.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
//var OVERTE_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function printVector(string, vector) {
print(string + " " + vector.x + ", " + vector.y + ", " + vector.z);
}
var timePassed = 0.0;
var updateSpeed = 3.0;
var X_MIN = 5.0;
var X_MAX = 15.0;
var Z_MIN = 5.0;
var Z_MAX = 15.0;
var Y_PELVIS = 1.0;
Agent.setIsAvatar(true);
// change the avatar's position to the random one
Avatar.position = {x:-8.6826,y:-14.1982,z:129.0581}; // { x: getRandomFloat(X_MIN, X_MAX), y: Y_PELVIS, z: getRandomFloat(Z_MIN, Z_MAX) };;
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
Avatar.scale = 1.0;
printVector("New bot, position = ", Avatar.position);
//Avatar.setSkeletonModelURL("https://oaktown.pl/bz_proto_1/proto_anim_test_2.fst");
var animationData = {url: "https://oaktown.pl/bz_proto_1/proto_anim_test_2.fbx", firstFrame: 1, lastFrame: 120, fps: 30};
//Avatar.startAnimation(animationData.url, animationData.fps, 1, true, false, 1, animationData.lastFrame);
var millisecondsToWaitBeforeStarting = 8 * 1000;
Script.setTimeout(function () {
Avatar.setSkeletonModelURL("https://oaktown.pl/bz_proto_1/proto_anim_test_2.fst");
print("Starting at", JSON.stringify(Avatar.position));
Avatar.startAnimation(animationData.url, animationData.fps, 1, true, false, 1, animationData.lastFrame);
var animationDetails = Avatar.getAnimationDetails();
print("Animation details: " + JSON.stringify(animationDetails));
}, millisecondsToWaitBeforeStarting);
Script.setTimeout(function () {
print("Starting at", JSON.stringify(Avatar.position));
Avatar.startAnimation(animationData.url, animationData.fps, 1, true, false, 1, animationData.lastFrame);
var animationDetails = Avatar.getAnimationDetails();
print("Animation details: " + JSON.stringify(animationDetails));
}, millisecondsToWaitBeforeStarting*2);
Script.setTimeout(function () {
var animationDetails = Avatar.getAnimationDetails();
print("Animation details: " + JSON.stringify(animationDetails));
}, millisecondsToWaitBeforeStarting*4);
function update(deltaTime) {
timePassed += deltaTime;
if (timePassed > updateSpeed) {
timePassed = 0;
var newPosition = Vec3.sum(Avatar.position, { x: getRandomFloat(-0.1, 0.1), y: 0, z: getRandomFloat(-0.1, 0.1) });
Avatar.position = newPosition;
Vec3.print("new:", newPosition);
}
}
Script.update.connect(update);
Script that works correctly:
//
// simpleBot.js
// examples
//
// Created by Brad Hefta-Gaub on 12/23/16.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
//var OVERTE_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function printVector(string, vector) {
print(string + " " + vector.x + ", " + vector.y + ", " + vector.z);
}
var timePassed = 0.0;
var updateSpeed = 3.0;
var X_MIN = 5.0;
var X_MAX = 15.0;
var Z_MIN = 5.0;
var Z_MAX = 15.0;
var Y_PELVIS = 1.0;
Agent.setIsAvatar(true);
// change the avatar's position to the random one
Avatar.position = {x:-8.6826,y:-14.1982,z:129.0581}; // { x: getRandomFloat(X_MIN, X_MAX), y: Y_PELVIS, z: getRandomFloat(Z_MIN, Z_MAX) };;
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
Avatar.scale = 1.0;
printVector("New bot, position = ", Avatar.position);
Avatar.setSkeletonModelURL("https://oaktown.pl/scripts/ac/ac_anim_test_1.fst");
var animationData = {url: "https://oaktown.pl/scripts/ac/ac_anim_test_1.fbx", firstFrame: 1, lastFrame: 120, fps: 30};
var millisecondsToWaitBeforeStarting = 8 * 1000;
Script.setTimeout(function () {
//Avatar.setSkeletonModelURL("https://oaktown.pl/scripts/ac/ac_anim_test_1.fst");
print("Starting at", JSON.stringify(Avatar.position));
Avatar.startAnimation(animationData.url, animationData.fps, 1, true, false, 1, animationData.lastFrame);
}, millisecondsToWaitBeforeStarting);
function update(deltaTime) {
timePassed += deltaTime;
if (timePassed > updateSpeed) {
timePassed = 0;
var newPosition = Vec3.sum(Avatar.position, { x: getRandomFloat(-0.1, 0.1), y: 0, z: getRandomFloat(-0.1, 0.1) });
Avatar.position = newPosition;
Vec3.print("new:", newPosition);
}
}
Script.update.connect(update);
The text was updated successfully, but these errors were encountered:
Same code works reasonably well in Interface, so maybe Assignment Client is doing something wrong?
Only position will be sent in such case and user is not warned at all:
Maybe instead data could be split over several packets?
Surprising part is that Interface deals pretty well with same avatars that don't work on Agent.
Example of broken Agent script:
Script that works correctly:
The text was updated successfully, but these errors were encountered: