mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:24:22 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into hand-controller-pointer
This commit is contained in:
commit
e956bf4b77
55 changed files with 888 additions and 318 deletions
|
@ -339,15 +339,16 @@ void RenderableModelEntityItem::updateModelBounds() {
|
|||
return;
|
||||
}
|
||||
bool movingOrAnimating = isMovingRelativeToParent() || isAnimatingSomething();
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
if ((movingOrAnimating ||
|
||||
_needsInitialSimulation ||
|
||||
_needsJointSimulation ||
|
||||
_model->getTranslation() != getPosition() ||
|
||||
_model->getScaleToFitDimensions() != getDimensions() ||
|
||||
_model->getScaleToFitDimensions() != dimensions ||
|
||||
_model->getRotation() != getRotation() ||
|
||||
_model->getRegistrationPoint() != getRegistrationPoint())
|
||||
&& _model->isActive() && _dimensionsInitialized) {
|
||||
_model->setScaleToFit(true, getDimensions());
|
||||
_model->setScaleToFit(true, dimensions);
|
||||
_model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
||||
_model->setRotation(getRotation());
|
||||
_model->setTranslation(getPosition());
|
||||
|
|
|
@ -206,13 +206,14 @@ glm::mat4 RenderablePolyVoxEntityItem::voxelToLocalMatrix() const {
|
|||
voxelVolumeSize = _voxelVolumeSize;
|
||||
});
|
||||
|
||||
glm::vec3 scale = getDimensions() / voxelVolumeSize; // meters / voxel-units
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::vec3 scale = dimensions / voxelVolumeSize; // meters / voxel-units
|
||||
bool success; // TODO -- Does this actually have to happen in world space?
|
||||
glm::vec3 center = getCenterPosition(success); // this handles registrationPoint changes
|
||||
glm::vec3 position = getPosition(success);
|
||||
glm::vec3 positionToCenter = center - position;
|
||||
|
||||
positionToCenter -= getDimensions() * Vectors::HALF - getSurfacePositionAdjustment();
|
||||
positionToCenter -= dimensions * Vectors::HALF - getSurfacePositionAdjustment();
|
||||
glm::mat4 centerToCorner = glm::translate(glm::mat4(), positionToCenter);
|
||||
glm::mat4 scaled = glm::scale(centerToCorner, scale);
|
||||
return scaled;
|
||||
|
@ -445,7 +446,8 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
|
|||
// the PolyVox ray intersection code requires a near and far point.
|
||||
// set ray cast length to long enough to cover all of the voxel space
|
||||
float distanceToEntity = glm::distance(origin, getPosition());
|
||||
float largestDimension = glm::max(getDimensions().x, getDimensions().y, getDimensions().z) * 2.0f;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
float largestDimension = glm::max(dimensions.x, dimensions.y, dimensions.z) * 2.0f;
|
||||
glm::vec3 farPoint = origin + normDirection * (distanceToEntity + largestDimension);
|
||||
|
||||
glm::vec4 originInVoxel = wtvMatrix * glm::vec4(origin, 1.0f);
|
||||
|
|
|
@ -119,12 +119,13 @@ bool RenderableWebEntityItem::buildWebSurface(EntityTreeRenderer* renderer) {
|
|||
|
||||
// Map the intersection point to an actual offscreen pixel
|
||||
glm::vec3 point = intersection.intersection;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
point -= getPosition();
|
||||
point = glm::inverse(getRotation()) * point;
|
||||
point /= getDimensions();
|
||||
point /= dimensions;
|
||||
point += 0.5f;
|
||||
point.y = 1.0f - point.y;
|
||||
point *= getDimensions() * METERS_TO_INCHES * DPI;
|
||||
point *= dimensions * (METERS_TO_INCHES * DPI);
|
||||
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
|
|
|
@ -781,7 +781,8 @@ void EntityItem::adjustEditPacketForClockSkew(QByteArray& buffer, qint64 clockSk
|
|||
}
|
||||
|
||||
float EntityItem::computeMass() const {
|
||||
return _density * _volumeMultiplier * getDimensions().x * getDimensions().y * getDimensions().z;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
return _density * _volumeMultiplier * dimensions.x * dimensions.y * dimensions.z;
|
||||
}
|
||||
|
||||
void EntityItem::setDensity(float density) {
|
||||
|
@ -801,7 +802,8 @@ void EntityItem::setMass(float mass) {
|
|||
// we must protect the density range to help maintain stability of physics simulation
|
||||
// therefore this method might not accept the mass that is supplied.
|
||||
|
||||
float volume = _volumeMultiplier * getDimensions().x * getDimensions().y * getDimensions().z;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
float volume = _volumeMultiplier * dimensions.x * dimensions.y * dimensions.z;
|
||||
|
||||
// compute new density
|
||||
const float MIN_VOLUME = 1.0e-6f; // 0.001mm^3
|
||||
|
@ -1222,11 +1224,13 @@ AACube EntityItem::getMaximumAACube(bool& success) const {
|
|||
// * we know that the position is the center of rotation
|
||||
glm::vec3 centerOfRotation = getPosition(success); // also where _registration point is
|
||||
if (success) {
|
||||
_recalcMaxAACube = false;
|
||||
// * we know that the registration point is the center of rotation
|
||||
// * we can calculate the length of the furthest extent from the registration point
|
||||
// as the dimensions * max (registrationPoint, (1.0,1.0,1.0) - registrationPoint)
|
||||
glm::vec3 registrationPoint = (getDimensions() * getRegistrationPoint());
|
||||
glm::vec3 registrationRemainder = (getDimensions() * (glm::vec3(1.0f, 1.0f, 1.0f) - getRegistrationPoint()));
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::vec3 registrationPoint = (dimensions * _registrationPoint);
|
||||
glm::vec3 registrationRemainder = (dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint));
|
||||
glm::vec3 furthestExtentFromRegistration = glm::max(registrationPoint, registrationRemainder);
|
||||
|
||||
// * we know that if you rotate in any direction you would create a sphere
|
||||
|
@ -1238,7 +1242,6 @@ AACube EntityItem::getMaximumAACube(bool& success) const {
|
|||
glm::vec3 minimumCorner = centerOfRotation - glm::vec3(radius, radius, radius);
|
||||
|
||||
_maxAACube = AACube(minimumCorner, radius * 2.0f);
|
||||
_recalcMaxAACube = false;
|
||||
}
|
||||
} else {
|
||||
success = true;
|
||||
|
@ -1251,28 +1254,27 @@ AACube EntityItem::getMaximumAACube(bool& success) const {
|
|||
///
|
||||
AACube EntityItem::getMinimumAACube(bool& success) const {
|
||||
if (_recalcMinAACube) {
|
||||
// _position represents the position of the registration point.
|
||||
glm::vec3 registrationRemainder = glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint;
|
||||
|
||||
glm::vec3 unrotatedMinRelativeToEntity = - (getDimensions() * getRegistrationPoint());
|
||||
glm::vec3 unrotatedMaxRelativeToEntity = getDimensions() * registrationRemainder;
|
||||
Extents unrotatedExtentsRelativeToRegistrationPoint = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity };
|
||||
Extents rotatedExtentsRelativeToRegistrationPoint =
|
||||
unrotatedExtentsRelativeToRegistrationPoint.getRotated(getRotation());
|
||||
|
||||
// shift the extents to be relative to the position/registration point
|
||||
rotatedExtentsRelativeToRegistrationPoint.shiftBy(getPosition(success));
|
||||
|
||||
// position represents the position of the registration point.
|
||||
glm::vec3 position = getPosition(success);
|
||||
if (success) {
|
||||
_recalcMinAACube = false;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::vec3 unrotatedMinRelativeToEntity = - (dimensions * _registrationPoint);
|
||||
glm::vec3 unrotatedMaxRelativeToEntity = dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint);
|
||||
Extents extents = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity };
|
||||
extents.rotate(getRotation());
|
||||
|
||||
// shift the extents to be relative to the position/registration point
|
||||
extents.shiftBy(position);
|
||||
|
||||
// the cube that best encompasses extents is...
|
||||
AABox box(rotatedExtentsRelativeToRegistrationPoint);
|
||||
AABox box(extents);
|
||||
glm::vec3 centerOfBox = box.calcCenter();
|
||||
float longestSide = box.getLargestDimension();
|
||||
float halfLongestSide = longestSide / 2.0f;
|
||||
glm::vec3 cornerOfCube = centerOfBox - glm::vec3(halfLongestSide, halfLongestSide, halfLongestSide);
|
||||
|
||||
_minAACube = AACube(cornerOfCube, longestSide);
|
||||
_recalcMinAACube = false;
|
||||
}
|
||||
} else {
|
||||
success = true;
|
||||
|
@ -1282,21 +1284,20 @@ AACube EntityItem::getMinimumAACube(bool& success) const {
|
|||
|
||||
AABox EntityItem::getAABox(bool& success) const {
|
||||
if (_recalcAABox) {
|
||||
// _position represents the position of the registration point.
|
||||
glm::vec3 registrationRemainder = glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint;
|
||||
|
||||
glm::vec3 unrotatedMinRelativeToEntity = - (getDimensions() * _registrationPoint);
|
||||
glm::vec3 unrotatedMaxRelativeToEntity = getDimensions() * registrationRemainder;
|
||||
Extents unrotatedExtentsRelativeToRegistrationPoint = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity };
|
||||
Extents rotatedExtentsRelativeToRegistrationPoint =
|
||||
unrotatedExtentsRelativeToRegistrationPoint.getRotated(getRotation());
|
||||
|
||||
// shift the extents to be relative to the position/registration point
|
||||
rotatedExtentsRelativeToRegistrationPoint.shiftBy(getPosition(success));
|
||||
|
||||
// position represents the position of the registration point.
|
||||
glm::vec3 position = getPosition(success);
|
||||
if (success) {
|
||||
_cachedAABox = AABox(rotatedExtentsRelativeToRegistrationPoint);
|
||||
_recalcAABox = false;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::vec3 unrotatedMinRelativeToEntity = - (dimensions * _registrationPoint);
|
||||
glm::vec3 unrotatedMaxRelativeToEntity = dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint);
|
||||
Extents extents = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity };
|
||||
extents.rotate(getRotation());
|
||||
|
||||
// shift the extents to be relative to the position/registration point
|
||||
extents.shiftBy(position);
|
||||
|
||||
_cachedAABox = AABox(extents);
|
||||
}
|
||||
} else {
|
||||
success = true;
|
||||
|
@ -1373,6 +1374,11 @@ void EntityItem::computeShapeInfo(ShapeInfo& info) {
|
|||
adjustShapeInfoByRegistration(info);
|
||||
}
|
||||
|
||||
float EntityItem::getVolumeEstimate() const {
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
return dimensions.x * dimensions.y * dimensions.z;
|
||||
}
|
||||
|
||||
void EntityItem::updateRegistrationPoint(const glm::vec3& value) {
|
||||
if (value != _registrationPoint) {
|
||||
setRegistrationPoint(value);
|
||||
|
@ -1433,7 +1439,8 @@ void EntityItem::updateMass(float mass) {
|
|||
// we must protect the density range to help maintain stability of physics simulation
|
||||
// therefore this method might not accept the mass that is supplied.
|
||||
|
||||
float volume = _volumeMultiplier * getDimensions().x * getDimensions().y * getDimensions().z;
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
float volume = _volumeMultiplier * dimensions.x * dimensions.y * dimensions.z;
|
||||
|
||||
// compute new density
|
||||
float newDensity = _density;
|
||||
|
|
|
@ -314,7 +314,7 @@ public:
|
|||
|
||||
virtual bool isReadyToComputeShape() { return !isDead(); }
|
||||
virtual void computeShapeInfo(ShapeInfo& info);
|
||||
virtual float getVolumeEstimate() const { return getDimensions().x * getDimensions().y * getDimensions().z; }
|
||||
virtual float getVolumeEstimate() const;
|
||||
|
||||
/// return preferred shape type (actual physical shape may differ)
|
||||
virtual ShapeType getShapeType() const { return SHAPE_TYPE_NONE; }
|
||||
|
|
|
@ -76,12 +76,13 @@ void LightEntityItem::setIsSpotlight(bool value) {
|
|||
if (value != _isSpotlight) {
|
||||
_isSpotlight = value;
|
||||
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
if (_isSpotlight) {
|
||||
const float length = getDimensions().z;
|
||||
const float length = dimensions.z;
|
||||
const float width = length * glm::sin(glm::radians(_cutoff));
|
||||
setDimensions(glm::vec3(width, width, length));
|
||||
} else {
|
||||
float maxDimension = glm::max(getDimensions().x, getDimensions().y, getDimensions().z);
|
||||
float maxDimension = glm::max(dimensions.x, dimensions.y, dimensions.z);
|
||||
setDimensions(glm::vec3(maxDimension, maxDimension, maxDimension));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,15 +101,13 @@ bool LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
|||
if (points.size() > MAX_POINTS_PER_LINE) {
|
||||
return false;
|
||||
}
|
||||
glm::vec3 halfBox = getDimensions() * 0.5f;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
glm::vec3 point = points.at(i);
|
||||
// glm::vec3 pos = getPosition();
|
||||
glm::vec3 halfBox = getDimensions() * 0.5f;
|
||||
if ( (point.x < - halfBox.x || point.x > halfBox.x) || (point.y < -halfBox.y || point.y > halfBox.y) || (point.z < - halfBox.z || point.z > halfBox.z) ) {
|
||||
qDebug() << "Point is outside entity's bounding box";
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
_points = points;
|
||||
_pointsChanged = true;
|
||||
|
|
|
@ -325,47 +325,117 @@ void AssetClient::handleAssetGetReply(QSharedPointer<ReceivedMessage> message, S
|
|||
|
||||
// Check if we have any pending requests for this node
|
||||
auto messageMapIt = _pendingRequests.find(senderNode);
|
||||
if (messageMapIt != _pendingRequests.end()) {
|
||||
if (messageMapIt == _pendingRequests.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Found the node, get the MessageID -> Callback map
|
||||
auto& messageCallbackMap = messageMapIt->second;
|
||||
|
||||
// Check if we have this pending request
|
||||
auto requestIt = messageCallbackMap.find(messageID);
|
||||
if (requestIt != messageCallbackMap.end()) {
|
||||
auto& callbacks = requestIt->second;
|
||||
|
||||
// Store message in case we need to disconnect from it later.
|
||||
callbacks.message = message;
|
||||
|
||||
if (message->isComplete()) {
|
||||
callbacks.completeCallback(true, error, message->readAll());
|
||||
messageCallbackMap.erase(requestIt);
|
||||
} else {
|
||||
connect(message.data(), &ReceivedMessage::progress, this, [this, length, message, &callbacks]() {
|
||||
callbacks.progressCallback(message->getSize(), length);
|
||||
});
|
||||
connect(message.data(), &ReceivedMessage::completed, this, [this, messageID, message, &messageCallbackMap, &callbacks]() {
|
||||
if (message->failed()) {
|
||||
callbacks.completeCallback(false, AssetServerError::NoError, QByteArray());
|
||||
} else {
|
||||
callbacks.completeCallback(true, AssetServerError::NoError, message->readAll());
|
||||
}
|
||||
|
||||
// We should never get to this point without the associated senderNode and messageID
|
||||
// in our list of pending requests. If the senderNode had disconnected or the message
|
||||
// had been canceled, we should have been disconnected from the ReceivedMessage
|
||||
// signals and thus never had this lambda called.
|
||||
messageCallbackMap.erase(messageID);
|
||||
});
|
||||
}
|
||||
}
|
||||
// Found the node, get the MessageID -> Callback map
|
||||
auto& messageCallbackMap = messageMapIt->second;
|
||||
|
||||
// Check if we have this pending request
|
||||
auto requestIt = messageCallbackMap.find(messageID);
|
||||
if (requestIt == messageCallbackMap.end()) {
|
||||
// Although the messageCallbackMap may now be empty, we won't delete the node until we have disconnected from
|
||||
// it to avoid constantly creating/deleting the map on subsequent requests.
|
||||
return;
|
||||
}
|
||||
|
||||
auto& callbacks = requestIt->second;
|
||||
|
||||
// Store message in case we need to disconnect from it later.
|
||||
callbacks.message = message;
|
||||
|
||||
if (message->isComplete()) {
|
||||
callbacks.completeCallback(true, error, message->readAll());
|
||||
messageCallbackMap.erase(requestIt);
|
||||
} else {
|
||||
auto weakNode = senderNode.toWeakRef();
|
||||
|
||||
connect(message.data(), &ReceivedMessage::progress, this, [this, weakNode, messageID, length]() {
|
||||
handleProgressCallback(weakNode, messageID, length);
|
||||
});
|
||||
connect(message.data(), &ReceivedMessage::completed, this, [this, weakNode, messageID]() {
|
||||
handleCompleteCallback(weakNode, messageID);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void AssetClient::handleProgressCallback(const QWeakPointer<Node>& node, MessageID messageID, DataOffset length) {
|
||||
auto senderNode = node.toStrongRef();
|
||||
|
||||
if (!senderNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we have any pending requests for this node
|
||||
auto messageMapIt = _pendingRequests.find(senderNode);
|
||||
if (messageMapIt == _pendingRequests.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Found the node, get the MessageID -> Callback map
|
||||
auto& messageCallbackMap = messageMapIt->second;
|
||||
|
||||
// Check if we have this pending request
|
||||
auto requestIt = messageCallbackMap.find(messageID);
|
||||
if (requestIt == messageCallbackMap.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& callbacks = requestIt->second;
|
||||
auto& message = callbacks.message;
|
||||
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
|
||||
callbacks.progressCallback(message->getSize(), length);
|
||||
}
|
||||
|
||||
void AssetClient::handleCompleteCallback(const QWeakPointer<Node>& node, MessageID messageID) {
|
||||
auto senderNode = node.toStrongRef();
|
||||
|
||||
if (!senderNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we have any pending requests for this node
|
||||
auto messageMapIt = _pendingRequests.find(senderNode);
|
||||
if (messageMapIt == _pendingRequests.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Found the node, get the MessageID -> Callback map
|
||||
auto& messageCallbackMap = messageMapIt->second;
|
||||
|
||||
// Check if we have this pending request
|
||||
auto requestIt = messageCallbackMap.find(messageID);
|
||||
if (requestIt == messageCallbackMap.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& callbacks = requestIt->second;
|
||||
auto& message = callbacks.message;
|
||||
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (message->failed()) {
|
||||
callbacks.completeCallback(false, AssetServerError::NoError, QByteArray());
|
||||
} else {
|
||||
callbacks.completeCallback(true, AssetServerError::NoError, message->readAll());
|
||||
}
|
||||
|
||||
// We should never get to this point without the associated senderNode and messageID
|
||||
// in our list of pending requests. If the senderNode had disconnected or the message
|
||||
// had been canceled, we should have been disconnected from the ReceivedMessage
|
||||
// signals and thus never had this lambda called.
|
||||
messageCallbackMap.erase(messageID);
|
||||
}
|
||||
|
||||
|
||||
MessageID AssetClient::getAssetMapping(const AssetPath& path, MappingOperationCallback callback) {
|
||||
Q_ASSERT(QThread::currentThread() == thread());
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ private:
|
|||
bool cancelGetAssetRequest(MessageID id);
|
||||
bool cancelUploadAssetRequest(MessageID id);
|
||||
|
||||
void handleProgressCallback(const QWeakPointer<Node>& node, MessageID messageID, DataOffset length);
|
||||
void handleCompleteCallback(const QWeakPointer<Node>& node, MessageID messageID);
|
||||
|
||||
struct GetAssetRequestData {
|
||||
QSharedPointer<ReceivedMessage> message;
|
||||
ReceivedAssetCallback completeCallback;
|
||||
|
|
|
@ -25,15 +25,12 @@ UserActivityLogger& UserActivityLogger::getInstance() {
|
|||
return sharedInstance;
|
||||
}
|
||||
|
||||
UserActivityLogger::UserActivityLogger() : _disabled(false) {
|
||||
}
|
||||
|
||||
void UserActivityLogger::disable(bool disable) {
|
||||
_disabled = disable;
|
||||
_disabled.set(disable);
|
||||
}
|
||||
|
||||
void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCallbackParameters params) {
|
||||
if (_disabled) {
|
||||
if (_disabled.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,7 +60,7 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
|
|||
}
|
||||
|
||||
accountManager.sendRequest(USER_ACTIVITY_URL,
|
||||
AccountManagerAuth::Required,
|
||||
AccountManagerAuth::Optional,
|
||||
QNetworkAccessManager::PostOperation,
|
||||
params, NULL, multipart);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <QJsonObject>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <SettingHandle.h>
|
||||
|
||||
class UserActivityLogger : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -44,8 +46,8 @@ private slots:
|
|||
void requestError(QNetworkReply& errorReply);
|
||||
|
||||
private:
|
||||
UserActivityLogger();
|
||||
bool _disabled;
|
||||
UserActivityLogger() {};
|
||||
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", false };
|
||||
};
|
||||
|
||||
#endif // hifi_UserActivityLogger_h
|
||||
|
|
|
@ -17,7 +17,5 @@ Script.load("system/notifications.js");
|
|||
Script.load("system/controllers/handControllerGrab.js");
|
||||
Script.load("system/controllers/squeezeHands.js");
|
||||
Script.load("system/controllers/grab.js");
|
||||
Script.load("system/directory.js");
|
||||
Script.load("system/dialTone.js");
|
||||
// Script.load("attachedEntitiesManager.js");
|
||||
Script.load("system/depthReticle.js");
|
|
@ -26,7 +26,7 @@ var directoryWindow = new OverlayWebWindow({
|
|||
|
||||
var toolHeight = 50;
|
||||
var toolWidth = 50;
|
||||
var TOOLBAR_MARGIN_Y = 25;
|
||||
var TOOLBAR_MARGIN_Y = 0;
|
||||
|
||||
|
||||
function showDirectory() {
|
||||
|
|
|
@ -48,12 +48,12 @@ var entityListTool = EntityListTool();
|
|||
selectionManager.addEventListener(function() {
|
||||
selectionDisplay.updateHandles();
|
||||
lightOverlayManager.updatePositions();
|
||||
});
|
||||
});
|
||||
|
||||
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
||||
var toolHeight = 50;
|
||||
var toolWidth = 50;
|
||||
var TOOLBAR_MARGIN_Y = 25;
|
||||
var TOOLBAR_MARGIN_Y = 0;
|
||||
|
||||
var DEGREES_TO_RADIANS = Math.PI / 180.0;
|
||||
var RADIANS_TO_DEGREES = 180.0 / Math.PI;
|
||||
|
@ -191,7 +191,7 @@ var toolBar = (function() {
|
|||
});
|
||||
|
||||
activeButton = toolBar.addTool({
|
||||
imageURL: toolIconUrl + "edit-01.svg",
|
||||
imageURL: toolIconUrl + "edit-01.svg",
|
||||
subImage: {
|
||||
x: 0,
|
||||
y: Tool.IMAGE_WIDTH,
|
||||
|
@ -205,7 +205,7 @@ var toolBar = (function() {
|
|||
}, true, false);
|
||||
|
||||
newModelButton = toolBar.addTool({
|
||||
imageURL:toolIconUrl + "model-01.svg",
|
||||
imageURL: toolIconUrl + "model-01.svg",
|
||||
subImage: {
|
||||
x: 0,
|
||||
y: Tool.IMAGE_WIDTH,
|
||||
|
@ -220,7 +220,7 @@ var toolBar = (function() {
|
|||
});
|
||||
|
||||
newCubeButton = toolBar.addTool({
|
||||
imageURL:toolIconUrl + "cube-01.svg",
|
||||
imageURL: toolIconUrl + "cube-01.svg",
|
||||
subImage: {
|
||||
x: 0,
|
||||
y: Tool.IMAGE_WIDTH,
|
||||
|
@ -336,7 +336,9 @@ var toolBar = (function() {
|
|||
if (active && !Entities.canAdjustLocks()) {
|
||||
Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG);
|
||||
} else {
|
||||
Messages.sendLocalMessage("edit-events", JSON.stringify({enabled: active}));
|
||||
Messages.sendLocalMessage("edit-events", JSON.stringify({
|
||||
enabled: active
|
||||
}));
|
||||
isActive = active;
|
||||
if (!isActive) {
|
||||
entityListTool.setVisible(false);
|
||||
|
@ -549,8 +551,16 @@ var toolBar = (function() {
|
|||
type: "ParticleEffect",
|
||||
isEmitting: true,
|
||||
particleRadius: 0.1,
|
||||
emitAcceleration: {x: 0, y: -1, z: 0},
|
||||
accelerationSpread: {x: 5, y: 0, z: 5},
|
||||
emitAcceleration: {
|
||||
x: 0,
|
||||
y: -1,
|
||||
z: 0
|
||||
},
|
||||
accelerationSpread: {
|
||||
x: 5,
|
||||
y: 0,
|
||||
z: 5
|
||||
},
|
||||
emitSpeed: 1,
|
||||
lifespan: 1,
|
||||
particleRadius: 0.025,
|
||||
|
@ -563,7 +573,7 @@ var toolBar = (function() {
|
|||
return false;
|
||||
};
|
||||
|
||||
that.mouseReleaseEvent = function (event) {
|
||||
that.mouseReleaseEvent = function(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -604,7 +614,7 @@ var intersection;
|
|||
|
||||
var SCALE_FACTOR = 200.0;
|
||||
|
||||
function rayPlaneIntersection(pickRay, point, normal) { //
|
||||
function rayPlaneIntersection(pickRay, point, normal) { //
|
||||
//
|
||||
// This version of the test returns the intersection of a line with a plane
|
||||
//
|
||||
|
@ -1207,7 +1217,9 @@ function toggleSelectedEntitiesLocked() {
|
|||
var locked = !Entities.getEntityProperties(SelectionManager.selections[0], ["locked"]).locked;
|
||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||
var entityID = SelectionManager.selections[i];
|
||||
Entities.editEntity(entityID, { locked: locked });
|
||||
Entities.editEntity(entityID, {
|
||||
locked: locked
|
||||
});
|
||||
}
|
||||
entityListTool.sendUpdate();
|
||||
selectionManager._update();
|
||||
|
@ -1219,7 +1231,9 @@ function toggleSelectedEntitiesVisible() {
|
|||
var visible = !Entities.getEntityProperties(SelectionManager.selections[0], ["visible"]).visible;
|
||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||
var entityID = SelectionManager.selections[i];
|
||||
Entities.editEntity(entityID, { visible: visible });
|
||||
Entities.editEntity(entityID, {
|
||||
visible: visible
|
||||
});
|
||||
}
|
||||
entityListTool.sendUpdate();
|
||||
selectionManager._update();
|
||||
|
@ -1554,8 +1568,7 @@ PropertiesTool = function(opts) {
|
|||
data.properties.keyLight.direction.x * DEGREES_TO_RADIANS, data.properties.keyLight.direction.y * DEGREES_TO_RADIANS);
|
||||
}
|
||||
Entities.editEntity(selectionManager.selections[0], data.properties);
|
||||
if (data.properties.name !== undefined || data.properties.modelURL !== undefined
|
||||
|| data.properties.visible !== undefined || data.properties.locked !== undefined) {
|
||||
if (data.properties.name !== undefined || data.properties.modelURL !== undefined || data.properties.visible !== undefined || data.properties.locked !== undefined) {
|
||||
entityListTool.sendUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -1835,15 +1848,15 @@ entityListTool.webView.webEventReceived.connect(function(data) {
|
|||
var data = JSON.parse(data);
|
||||
if (data.type == "selectionUpdate") {
|
||||
var ids = data.entityIds;
|
||||
if(ids.length === 1) {
|
||||
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect" ) {
|
||||
if (ids.length === 1) {
|
||||
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") {
|
||||
if (JSON.stringify(selectedParticleEntity) === JSON.stringify(ids[0])) {
|
||||
// This particle entity is already selected, so return
|
||||
return;
|
||||
}
|
||||
// Destroy the old particles web view first
|
||||
particleExplorerTool.destroyWebView();
|
||||
particleExplorerTool.createWebView();
|
||||
particleExplorerTool.destroyWebView();
|
||||
particleExplorerTool.createWebView();
|
||||
var properties = Entities.getEntityProperties(ids[0]);
|
||||
var particleData = {
|
||||
messageType: "particle_settings",
|
||||
|
@ -1855,7 +1868,7 @@ entityListTool.webView.webEventReceived.connect(function(data) {
|
|||
particleExplorerTool.webView.webEventReceived.connect(function(data) {
|
||||
var data = JSON.parse(data);
|
||||
if (data.messageType === "page_loaded") {
|
||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
||||
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -1864,4 +1877,4 @@ entityListTool.webView.webEventReceived.connect(function(data) {
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
|
@ -26,7 +26,7 @@ var examplesWindow = new OverlayWebWindow({
|
|||
|
||||
var toolHeight = 50;
|
||||
var toolWidth = 50;
|
||||
var TOOLBAR_MARGIN_Y = 25;
|
||||
var TOOLBAR_MARGIN_Y = 0;
|
||||
|
||||
|
||||
function showExamples(marketplaceID) {
|
||||
|
@ -58,7 +58,7 @@ var toolBar = (function() {
|
|||
browseExamplesButton;
|
||||
|
||||
function initialize() {
|
||||
toolBar = new ToolBar(0, 0, ToolBar.HORIXONTAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) {
|
||||
toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) {
|
||||
return {
|
||||
x: windowDimensions.x / 2,
|
||||
y: windowDimensions.y
|
||||
|
|
|
@ -378,4 +378,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -59,6 +59,8 @@ EntityListTool = function(opts) {
|
|||
name: properties.name,
|
||||
type: properties.type,
|
||||
url: properties.type == "Model" ? properties.modelURL : "",
|
||||
locked: properties.locked,
|
||||
visible: properties.visible
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -99,6 +101,10 @@ EntityListTool = function(opts) {
|
|||
}
|
||||
} else if (data.type == "delete") {
|
||||
deleteSelectedEntities();
|
||||
} else if (data.type == "toggleLocked") {
|
||||
toggleSelectedEntitiesLocked();
|
||||
} else if (data.type == "toggleVisible") {
|
||||
toggleSelectedEntitiesVisible();
|
||||
} else if (data.type === "radius") {
|
||||
searchRadius = data.radius;
|
||||
that.sendUpdate();
|
||||
|
@ -112,4 +118,4 @@ EntityListTool = function(opts) {
|
|||
});
|
||||
|
||||
return that;
|
||||
};
|
||||
};
|
|
@ -383,6 +383,9 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
|||
};
|
||||
if (optionalPersistenceKey) {
|
||||
this.fractionKey = optionalPersistenceKey + '.fraction';
|
||||
// FIXME: New default position in RC8 is bottom center of screen instead of right. Can remove this key and associated
|
||||
// code once the new toolbar position is well established with users.
|
||||
this.isNewPositionKey = optionalPersistenceKey + '.isNewPosition';
|
||||
this.save = function () {
|
||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||
var screenSize = { x: recommendedRect.width, y: recommendedRect.height };
|
||||
|
@ -452,7 +455,10 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit
|
|||
return id;
|
||||
}
|
||||
if (this.fractionKey || optionalInitialPositionFunction) {
|
||||
var savedFraction = JSON.parse(Settings.getValue(this.fractionKey) || '0'); // getValue can answer empty string
|
||||
var isNewPosition = Settings.getValue(this.isNewPositionKey);
|
||||
var savedFraction = isNewPosition ? JSON.parse(Settings.getValue(this.fractionKey) || "0") : 0;
|
||||
Settings.setValue(this.isNewPositionKey, true);
|
||||
|
||||
var recommendedRect = Controller.getRecommendedOverlayRect();
|
||||
var screenSize = { x: recommendedRect.width, y: recommendedRect.height };
|
||||
if (savedFraction) {
|
||||
|
|
|
@ -31,7 +31,8 @@ var BUTTON_SIZE = 32;
|
|||
var PADDING = 3;
|
||||
|
||||
//a helper library for creating toolbars
|
||||
Script.include(["../default/libraries/toolBars.js"]);
|
||||
Script.include("http://hifi-production.s3.amazonaws.com/tutorials/dice/toolBars.js");
|
||||
|
||||
var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function(screenSize) {
|
||||
return {
|
||||
x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING),
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"parentID": "{f59b50d8-13fb-4ceb-b80a-62cd03428a7c}",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": -0.075,
|
||||
"y": 0.11,
|
||||
"z": 0
|
||||
},
|
||||
"queryAACube": {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
var soundMap = [{
|
||||
name: 'river water',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/Water_Lap_River_Edge_Gentle.L.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Water_Lap_River_Edge_Gentle.L.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 580,
|
||||
|
@ -22,7 +22,7 @@ var soundMap = [{
|
|||
}
|
||||
}, {
|
||||
name: 'windmill',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/WINDMILL_Mono.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/WINDMILL_Mono.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 530,
|
||||
|
@ -34,7 +34,7 @@ var soundMap = [{
|
|||
}
|
||||
}, {
|
||||
name: 'insects',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/insects3.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/insects3.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 560,
|
||||
|
@ -46,7 +46,7 @@ var soundMap = [{
|
|||
}
|
||||
}, {
|
||||
name: 'fireplace',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/demo/0619_Fireplace__Tree_B.L.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/0619_Fireplace__Tree_B.L.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 551.61,
|
||||
|
@ -58,7 +58,7 @@ var soundMap = [{
|
|||
}
|
||||
}, {
|
||||
name: 'cat purring',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/Cat_Purring_Deep_Low_Snor.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Cat_Purring_Deep_Low_Snor.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 551.48,
|
||||
|
@ -70,7 +70,7 @@ var soundMap = [{
|
|||
}
|
||||
}, {
|
||||
name: 'dogs barking',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/dogs_barking_1.L.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/dogs_barking_1.L.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 523,
|
||||
|
@ -83,7 +83,7 @@ var soundMap = [{
|
|||
playAtInterval: 60 * 1000
|
||||
}, {
|
||||
name: 'arcade game',
|
||||
url: "http://hifi-public.s3.amazonaws.com/ryan/ARCADE_GAMES_VID.L.L.wav",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/ARCADE_GAMES_VID.L.L.wav",
|
||||
audioOptions: {
|
||||
position: {
|
||||
x: 543.77,
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
//
|
||||
// This is a script that creates a persistent basketball hoop with a working collision hull. Feel free to move it.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
|
||||
var hoopURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop.fbx";
|
||||
var hoopCollisionHullURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop_collision_hull.obj";
|
||||
|
||||
var hoopURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop.fbx";
|
||||
var hoopCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop_collision_hull.obj";
|
||||
|
||||
var hoopStartPosition =
|
||||
Vec3.sum(MyAvatar.position,
|
||||
|
|
|
@ -8,15 +8,13 @@
|
|||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
Script.include("../../libraries/utils.js");
|
||||
|
||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
||||
var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
||||
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
|
||||
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
|
||||
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
|
||||
var rackCollisionHullURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
|
||||
var NUMBER_OF_BALLS = 4;
|
||||
var DIAMETER = 0.30;
|
||||
var RESET_DISTANCE = 1;
|
||||
|
|
|
@ -9,10 +9,9 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
||||
var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
||||
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
var collisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||
|
||||
|
||||
var basketball = null;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
(function() {
|
||||
|
||||
|
@ -42,8 +41,8 @@ var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|||
createBasketballs: function() {
|
||||
var NUMBER_OF_BALLS = 4;
|
||||
var DIAMETER = 0.30;
|
||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
||||
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
||||
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
var basketballCollisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||
|
||||
var position = {
|
||||
x: 542.86,
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
(function() {
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var NOTCH_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/notch.wav';
|
||||
var SHOOT_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/String_release2.L.wav';
|
||||
var STRING_PULL_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Bow_draw.1.L.wav';
|
||||
var ARROW_HIT_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Arrow_impact1.L.wav'
|
||||
var NOTCH_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/notch.wav';
|
||||
var SHOOT_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/String_release2.L.wav';
|
||||
var STRING_PULL_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Bow_draw.1.L.wav';
|
||||
var ARROW_HIT_SOUND_URL = 'https://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Arrow_impact1.L.wav'
|
||||
|
||||
var ARROW_DIMENSIONS = {
|
||||
x: 0.02,
|
||||
|
@ -32,9 +32,9 @@
|
|||
z: 0
|
||||
};
|
||||
|
||||
var ARROW_MODEL_URL = "http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_textured.fbx";
|
||||
var ARROW_MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_textured.fbx";
|
||||
var ARROW_COLLISION_HULL_URL =
|
||||
"http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_collision_hull.obj";
|
||||
"http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_collision_hull.obj";
|
||||
|
||||
var ARROW_DIMENSIONS = {
|
||||
x: 0.02,
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var utilsPath = Script.resolvePath('../../libraries/utils.js');
|
||||
var utilsPath = Script.resolvePath('libraries/utils.js');
|
||||
Script.include(utilsPath);
|
||||
|
||||
var SCRIPT_URL = Script.resolvePath('bow.js');
|
||||
|
||||
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
|
||||
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
|
||||
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
|
||||
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
|
||||
var BOW_DIMENSIONS = {
|
||||
x: 0.04,
|
||||
y: 1.3,
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj';
|
||||
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
|
||||
|
||||
var WAND_SCRIPT_URL = Script.resolvePath("wand.js");
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
(function() {
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var BUBBLE_MODEL = "http://hifi-content.s3.amazonaws.com/james/bubblewand/bubble.fbx";
|
||||
var BUBBLE_MODEL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/bubble.fbx";
|
||||
|
||||
var BUBBLE_INITIAL_DIMENSIONS = {
|
||||
x: 0.01,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
var _this;
|
||||
Cat = function() {
|
||||
_this = this;
|
||||
this.meowSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Animals/cat_meow.wav");
|
||||
this.meowSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/cat_meow.wav");
|
||||
};
|
||||
|
||||
Cat.prototype = {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
|
||||
function createDoll() {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
|
||||
|
||||
var scriptURL = Script.resolvePath("doll.js");
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
|
||||
(function() {
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
var _this;
|
||||
// this is the "constructor" for the entity as a JS object we don't do much here
|
||||
var Doll = function() {
|
||||
_this = this;
|
||||
this.screamSounds = [SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/KenDoll_1%2303.wav")];
|
||||
this.screamSounds = [SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/KenDoll_1%2303.wav")];
|
||||
};
|
||||
|
||||
Doll.prototype = {
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
Entities.editEntity(this.entityID, {
|
||||
animation: {
|
||||
url: "https://hifi-public.s3.amazonaws.com/models/Bboys/zombie_scream.fbx",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/zombie_scream.fbx",
|
||||
running: true
|
||||
}
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
var yVelocity = 0.0;
|
||||
var yAcceleration = -G;
|
||||
|
||||
var airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Air Swipe 05.wav");
|
||||
var airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Air%20Swipe%2005.wav");
|
||||
var injector = null;
|
||||
|
||||
this.position = function() {
|
||||
|
@ -51,7 +51,7 @@
|
|||
type: "Model",
|
||||
modelURL: MyAvatar.skeletonModelURL,
|
||||
animation: {
|
||||
url: "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims_160127/fly.fbx",
|
||||
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/fly.fbx",
|
||||
running: true,
|
||||
fps: 30,
|
||||
firstFrame: 1.0,
|
||||
|
@ -76,7 +76,7 @@
|
|||
animation: {running: false}
|
||||
});
|
||||
|
||||
airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/8bit Jump 03.wav");
|
||||
airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/8bit%20Jump%2003.wav");
|
||||
injector = null;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@
|
|||
|
||||
var id = entityManager.add({
|
||||
type: "Model",
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/coin.fbx",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/coin.fbx",
|
||||
angularVelocity: { x: 0, y: 20, z: 0 },
|
||||
position: to3DPosition(this.position()),
|
||||
dimensions:dimensions
|
||||
|
@ -172,14 +172,14 @@
|
|||
|
||||
var idUp = entityManager.add({
|
||||
type: "Model",
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx",
|
||||
rotation: Quat.fromPitchYawRollDegrees(180, 0, 0),
|
||||
position: to3DPosition({ x: xPosition, y: upYPosition }),
|
||||
dimensions: { x: width, y: upHeight, z: width }
|
||||
});
|
||||
var idDown = entityManager.add({
|
||||
type: "Model",
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx",
|
||||
position: to3DPosition({ x: xPosition, y: height / 2.0 }),
|
||||
dimensions: { x: width, y: height, z: width }
|
||||
});
|
||||
|
@ -217,7 +217,7 @@
|
|||
var pipes = new Array();
|
||||
var coins = new Array();
|
||||
|
||||
var coinsSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Coin.wav");
|
||||
var coinsSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Coin.wav");
|
||||
var injector = null;
|
||||
|
||||
this.update = function(deltaTime, gameTime, startedPlaying) {
|
||||
|
@ -325,7 +325,7 @@
|
|||
var numberDimensions = { x: 0.0660, y: 0.1050, z: 0.0048 };
|
||||
|
||||
function numberUrl(number) {
|
||||
return "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/" + number + ".fbx"
|
||||
return "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/" + number + ".fbx"
|
||||
}
|
||||
function digitPosition(digit) {
|
||||
return Vec3.multiplyQbyV(space.orientation, { x: 0.3778 + digit * (numberDimensions.x + 0.01), y: 0.0, z: 0.0 });
|
||||
|
@ -341,7 +341,7 @@
|
|||
|
||||
var bestId = entityManager.add({
|
||||
type: "Model",
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/best.fbx",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/best.fbx",
|
||||
position: topLeft,
|
||||
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
|
||||
dimensions: { x: 0.2781, y: 0.0063, z: 0.1037 }
|
||||
|
@ -359,7 +359,7 @@
|
|||
|
||||
var scoreId = entityManager.add({
|
||||
type: "Model",
|
||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/score.fbx",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/score.fbx",
|
||||
position: bottomLeft,
|
||||
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
|
||||
dimensions: { x: 0.3678, y: 0.0063, z: 0.1037 }
|
||||
|
@ -453,7 +453,7 @@
|
|||
var pipes = null;
|
||||
var score = null;
|
||||
|
||||
var gameOverSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Game Over.wav");
|
||||
var gameOverSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Game%20Over.wav");
|
||||
var injector = null;
|
||||
|
||||
var directions = ["UP", "DOWN", "LEFT", "RIGHT"];
|
||||
|
@ -466,7 +466,7 @@
|
|||
current = 0;
|
||||
}
|
||||
if (current === sequence.length) {
|
||||
avatar.changeModel("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/mario.fbx");
|
||||
avatar.changeModel("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/mario.fbx");
|
||||
current = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"dynamic": 1,
|
||||
"id": "{ee5b25e6-aca2-4dc7-9462-51537d89c126}",
|
||||
"modelURL": "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/cube.fbx",
|
||||
"modelURL": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/cube.fbx",
|
||||
"queryAACube": {
|
||||
"scale": 0.5974045991897583,
|
||||
"x": -5.1575918197631836,
|
||||
|
@ -23,7 +23,7 @@
|
|||
"y": -0.13279926776885986,
|
||||
"z": 0.34688329696655273
|
||||
},
|
||||
"script": "https://raw.githubusercontent.com/Atlante45/hifi/feat/hackaton/examples/toybox/flappyAvatars/flappyAvatars.js",
|
||||
"script": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/flappyAvatars.js",
|
||||
"scriptTimestamp": 1457031937425,
|
||||
"shapeType": "box",
|
||||
"type": "Model",
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var scriptURL = Script.resolvePath('flashlight.js');
|
||||
|
||||
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
|
||||
|
||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||
x: 0,
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
(function() {
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var ON_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav';
|
||||
var OFF_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_off.wav';
|
||||
var ON_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_on.wav';
|
||||
var OFF_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_off.wav';
|
||||
|
||||
//we are creating lights that we don't want to get stranded so lets make sure that we can get rid of them
|
||||
var startTime = Date.now();
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
// raveStickEntityScript.js
|
||||
//
|
||||
// Script Type: Entity
|
||||
// Created by Eric Levin on 12/16/15.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// This entity script create light trails on a given object as it moves.
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
(function() {
|
||||
|
||||
var _this;
|
||||
var LIFETIME = 6000;
|
||||
var DRAWING_DEPTH = 0.8;
|
||||
var LINE_DIMENSIONS = 100;
|
||||
var MAX_POINTS_PER_LINE = 50;
|
||||
var MIN_POINT_DISTANCE = 0.02;
|
||||
var STROKE_WIDTH = 0.05
|
||||
var ugLSD = 35;
|
||||
var RaveStick = function() {
|
||||
_this = this;
|
||||
this.colorPalette = [{
|
||||
red: 0,
|
||||
green: 200,
|
||||
blue: 40
|
||||
}, {
|
||||
red: 200,
|
||||
green: 10,
|
||||
blue: 40
|
||||
}];
|
||||
var texture = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/trails.png";
|
||||
this.trail = Entities.addEntity({
|
||||
type: "PolyLine",
|
||||
dimensions: {
|
||||
x: LINE_DIMENSIONS,
|
||||
y: LINE_DIMENSIONS,
|
||||
z: LINE_DIMENSIONS
|
||||
},
|
||||
color: {
|
||||
red: 255,
|
||||
green: 255,
|
||||
blue: 255
|
||||
},
|
||||
textures: texture,
|
||||
lifetime: LIFETIME
|
||||
});
|
||||
|
||||
this.points = [];
|
||||
this.normals = [];
|
||||
this.strokeWidths = [];
|
||||
};
|
||||
|
||||
RaveStick.prototype = {
|
||||
isGrabbed: false,
|
||||
|
||||
startNearGrab: function() {
|
||||
this.trailBasePosition = Entities.getEntityProperties(this.entityID, "position").position;
|
||||
Entities.editEntity(this.trail, {
|
||||
position: this.trailBasePosition
|
||||
});
|
||||
this.points = [];
|
||||
this.normals = [];
|
||||
this.strokeWidths = [];
|
||||
this.setupEraseInterval();
|
||||
},
|
||||
|
||||
continueNearGrab: function() {
|
||||
var props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
||||
var forwardVec = Quat.getFront(Quat.multiply(props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0)));
|
||||
forwardVec = Vec3.normalize(forwardVec);
|
||||
var forwardQuat = orientationOf(forwardVec);
|
||||
var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.04));
|
||||
var localPoint = Vec3.subtract(position, this.trailBasePosition);
|
||||
if (this.points.length >= 1 && Vec3.distance(localPoint, this.points[this.points.length - 1]) < MIN_POINT_DISTANCE) {
|
||||
//Need a minimum distance to avoid binormal NANs
|
||||
return;
|
||||
}
|
||||
if (this.points.length === MAX_POINTS_PER_LINE) {
|
||||
this.points.shift();
|
||||
this.normals.shift();
|
||||
this.strokeWidths.shift();
|
||||
}
|
||||
|
||||
this.points.push(localPoint);
|
||||
var normal = Quat.getUp(props.rotation);
|
||||
this.normals.push(normal);
|
||||
this.strokeWidths.push(STROKE_WIDTH);
|
||||
Entities.editEntity(this.trail, {
|
||||
linePoints: this.points,
|
||||
normals: this.normals,
|
||||
strokeWidths: this.strokeWidths
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
setupEraseInterval: function() {
|
||||
this.trailEraseInterval = Script.setInterval(function() {
|
||||
if (_this.points.length > 0) {
|
||||
_this.points.shift();
|
||||
_this.normals.shift();
|
||||
_this.strokeWidths.shift();
|
||||
Entities.editEntity(_this.trail, {
|
||||
linePoints: _this.points,
|
||||
strokeWidths: _this.strokeWidths,
|
||||
normals: _this.normals
|
||||
});
|
||||
}
|
||||
}, ugLSD);
|
||||
},
|
||||
|
||||
releaseGrab: function() {
|
||||
if (!this.trailEraseInterval) {
|
||||
return;
|
||||
}
|
||||
Script.setTimeout(function() {
|
||||
Script.clearInterval(_this.trailEraseInterval);
|
||||
_this.trailEraseInterval = null;
|
||||
}, 3000);
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
},
|
||||
|
||||
unload: function() {
|
||||
Entities.deleteEntity(this.beam);
|
||||
Entities.deleteEntity(this.trail);
|
||||
if (this.trailEraseInterval) {
|
||||
Script.clearInterval(this.trailEraseInterval);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
orientationOf = function(vector) {
|
||||
var Y_AXIS = {
|
||||
x: 0,
|
||||
y: 1,
|
||||
z: 0
|
||||
};
|
||||
var X_AXIS = {
|
||||
x: 1,
|
||||
y: 0,
|
||||
z: 0
|
||||
};
|
||||
|
||||
var theta = 0.0;
|
||||
|
||||
var RAD_TO_DEG = 180.0 / Math.PI;
|
||||
var direction, yaw, pitch;
|
||||
direction = Vec3.normalize(vector);
|
||||
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||
return Quat.multiply(yaw, pitch);
|
||||
}
|
||||
|
||||
function computeNormal(p1, p2) {
|
||||
return Vec3.normalize(Vec3.subtract(p2, p1));
|
||||
}
|
||||
return new RaveStick();
|
||||
});
|
|
@ -12,19 +12,22 @@
|
|||
|
||||
(function() {
|
||||
|
||||
var utilitiesScript = Script.resolvePath("libraries/utils.js");
|
||||
Script.include(utilitiesScript);
|
||||
|
||||
var _this;
|
||||
|
||||
var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js");
|
||||
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
||||
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
||||
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
||||
var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js');
|
||||
var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js");
|
||||
var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js");
|
||||
var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js");
|
||||
var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js');
|
||||
var bowScriptURL = Script.resolvePath('../examples/toybox/bow/bow.js');
|
||||
var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js");
|
||||
var gunScriptURL = Script.resolvePath("pistol/pistol.js");
|
||||
var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js");
|
||||
var catScriptURL = Script.resolvePath("cat/cat.js");
|
||||
var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js');
|
||||
var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js');
|
||||
var wandScriptURL = Script.resolvePath("bubblewand/wand.js");
|
||||
var dollScriptURL = Script.resolvePath("doll/doll.js");
|
||||
var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js");
|
||||
var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js');
|
||||
var bowScriptURL = Script.resolvePath('bow/bow.js');
|
||||
var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js");
|
||||
var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js');
|
||||
var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
||||
|
||||
|
@ -60,7 +63,6 @@
|
|||
MasterReset = function() {
|
||||
var resetKey = "resetMe";
|
||||
|
||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var shouldDeleteOnEndScript = false;
|
||||
|
||||
|
@ -168,7 +170,7 @@
|
|||
}
|
||||
|
||||
function createRaveStick(position) {
|
||||
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx";
|
||||
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||
var stick = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -258,7 +260,7 @@
|
|||
alphaSpread: 0.1,
|
||||
alphaStart: 0.1,
|
||||
alphaFinish: 0.1,
|
||||
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png",
|
||||
emitterShouldTrail: false,
|
||||
userData: JSON.stringify({
|
||||
resetMe: {
|
||||
|
@ -270,7 +272,7 @@
|
|||
}
|
||||
|
||||
function createGun(position) {
|
||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
|
||||
|
||||
var pistol = Entities.addEntity({
|
||||
type: 'Model',
|
||||
|
@ -279,7 +281,7 @@
|
|||
position: position,
|
||||
restitution: 0,
|
||||
damping: 0.5,
|
||||
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
|
||||
dimensions: {
|
||||
x: 0.05,
|
||||
y: 0.23,
|
||||
|
@ -343,8 +345,8 @@
|
|||
|
||||
var SCRIPT_URL = Script.resolvePath('bow.js');
|
||||
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
|
||||
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
|
||||
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
|
||||
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
|
||||
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
|
||||
|
||||
var BOW_DIMENSIONS = {
|
||||
x: 0.04,
|
||||
|
@ -496,7 +498,7 @@
|
|||
type: "ParticleEffect",
|
||||
name: "fire",
|
||||
animationSettings: animationSettings,
|
||||
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
||||
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png",
|
||||
position: {
|
||||
x: 551.45,
|
||||
y: 494.82,
|
||||
|
@ -559,10 +561,10 @@
|
|||
var DIAMETER = 0.30;
|
||||
var RESET_DISTANCE = 1;
|
||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
||||
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
||||
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
|
||||
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
|
||||
var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
|
||||
var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
|
||||
|
||||
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
||||
|
||||
|
@ -638,7 +640,7 @@
|
|||
z: 0
|
||||
},
|
||||
dynamic: true,
|
||||
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
|
||||
collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav',
|
||||
collisionless: false,
|
||||
modelURL: basketballURL,
|
||||
userData: JSON.stringify({
|
||||
|
@ -733,8 +735,8 @@
|
|||
|
||||
function createTargets() {
|
||||
|
||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||
|
||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||
var RESET_DISTANCE = 0.5;
|
||||
|
@ -813,8 +815,8 @@
|
|||
|
||||
function createCat(position) {
|
||||
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx";
|
||||
var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx";
|
||||
var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx";
|
||||
var animationSettings = JSON.stringify({
|
||||
running: true
|
||||
});
|
||||
|
@ -850,7 +852,7 @@
|
|||
}
|
||||
|
||||
function createFlashlight(position) {
|
||||
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
|
||||
|
||||
var flashlight = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -864,7 +866,7 @@
|
|||
z: 0.08
|
||||
},
|
||||
dynamic: true,
|
||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav",
|
||||
gravity: {
|
||||
x: 0,
|
||||
y: -3.5,
|
||||
|
@ -915,7 +917,7 @@
|
|||
}
|
||||
|
||||
function createLights() {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx";
|
||||
|
||||
|
||||
var rotation = {
|
||||
|
@ -1163,8 +1165,8 @@
|
|||
function createDice() {
|
||||
var diceProps = {
|
||||
type: "Model",
|
||||
modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx",
|
||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav",
|
||||
name: "dice",
|
||||
position: {
|
||||
x: 541.61,
|
||||
|
@ -1211,7 +1213,7 @@
|
|||
}
|
||||
|
||||
function createGates() {
|
||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx';
|
||||
|
||||
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
|
||||
var gate = Entities.addEntity({
|
||||
|
@ -1252,9 +1254,9 @@
|
|||
|
||||
function createPingPongBallGun() {
|
||||
|
||||
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
|
||||
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
|
||||
var position = {
|
||||
x: 548.6,
|
||||
y: 495.4,
|
||||
|
@ -1320,8 +1322,8 @@
|
|||
}
|
||||
|
||||
function createWand(position) {
|
||||
var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj';
|
||||
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
|
||||
|
||||
var wand = Entities.addEntity({
|
||||
name: 'Bubble Wand',
|
||||
|
@ -1381,7 +1383,7 @@
|
|||
|
||||
function createBasketBall(position) {
|
||||
|
||||
var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
|
||||
var entity = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -1407,7 +1409,7 @@
|
|||
y: -0.01,
|
||||
z: 0
|
||||
},
|
||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav",
|
||||
userData: JSON.stringify({
|
||||
resetMe: {
|
||||
resetMe: true
|
||||
|
@ -1421,7 +1423,7 @@
|
|||
}
|
||||
|
||||
function createDoll(position) {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
|
||||
|
||||
var naturalDimensions = {
|
||||
x: 1.63,
|
||||
|
@ -1462,7 +1464,7 @@
|
|||
|
||||
function createSprayCan(position) {
|
||||
|
||||
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx";
|
||||
|
||||
var entity = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -1476,7 +1478,7 @@
|
|||
z: 0.07
|
||||
},
|
||||
dynamic: true,
|
||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav",
|
||||
shapeType: 'box',
|
||||
restitution: 0,
|
||||
gravity: {
|
||||
|
@ -1502,7 +1504,7 @@
|
|||
}
|
||||
|
||||
function createPottedPlant(position) {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx";
|
||||
|
||||
var entity = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -1540,8 +1542,8 @@
|
|||
|
||||
|
||||
function createCombinedArmChair(position) {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx";
|
||||
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx";
|
||||
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj";
|
||||
|
||||
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
|
||||
|
||||
|
@ -1583,8 +1585,8 @@
|
|||
}
|
||||
|
||||
function createBlocks(position) {
|
||||
var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/";
|
||||
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
|
||||
var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/";
|
||||
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav";
|
||||
var NUM_BLOCKS_PER_COLOR = 4;
|
||||
var i, j;
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
|
||||
|
||||
Script.include('libraries/utils.js');
|
||||
var masterResetScript = Script.resolvePath("masterReset.js");
|
||||
var hiddenEntityScriptURL = Script.resolvePath("hiddenEntityReset.js");
|
||||
|
313
unpublishedScripts/DomainContent/Toybox/libraries/utils.js
Normal file
313
unpublishedScripts/DomainContent/Toybox/libraries/utils.js
Normal file
|
@ -0,0 +1,313 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2015/08/29
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
vec3toStr = function(v, digits) {
|
||||
if (!digits) { digits = 3; }
|
||||
return "{ " + v.x.toFixed(digits) + ", " + v.y.toFixed(digits) + ", " + v.z.toFixed(digits)+ " }";
|
||||
}
|
||||
|
||||
quatToStr = function(q, digits) {
|
||||
if (!digits) { digits = 3; }
|
||||
return "{ " + q.w.toFixed(digits) + ", " + q.x.toFixed(digits) + ", " +
|
||||
q.y.toFixed(digits) + ", " + q.z.toFixed(digits)+ " }";
|
||||
}
|
||||
|
||||
vec3equal = function(v0, v1) {
|
||||
return (v0.x == v1.x) && (v0.y == v1.y) && (v0.z == v1.z);
|
||||
}
|
||||
|
||||
colorMix = function(colorA, colorB, mix) {
|
||||
var result = {};
|
||||
for (var key in colorA) {
|
||||
result[key] = (colorA[key] * (1 - mix)) + (colorB[key] * mix);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
scaleLine = function (start, end, scale) {
|
||||
var v = Vec3.subtract(end, start);
|
||||
var length = Vec3.length(v);
|
||||
v = Vec3.multiply(scale, v);
|
||||
return Vec3.sum(start, v);
|
||||
}
|
||||
|
||||
findAction = function(name) {
|
||||
return Controller.findAction(name);
|
||||
}
|
||||
|
||||
addLine = function(origin, vector, color) {
|
||||
if (!color) {
|
||||
color = COLORS.WHITE
|
||||
}
|
||||
return Entities.addEntity(mergeObjects(LINE_PROTOTYPE, {
|
||||
position: origin,
|
||||
linePoints: [
|
||||
ZERO_VECTOR,
|
||||
vector,
|
||||
],
|
||||
color: color
|
||||
}));
|
||||
}
|
||||
|
||||
// FIXME fetch from a subkey of user data to support non-destructive modifications
|
||||
setEntityUserData = function(id, data) {
|
||||
var json = JSON.stringify(data)
|
||||
Entities.editEntity(id, { userData: json });
|
||||
}
|
||||
|
||||
// FIXME do non-destructive modification of the existing user data
|
||||
getEntityUserData = function(id) {
|
||||
var results = null;
|
||||
var properties = Entities.getEntityProperties(id, "userData");
|
||||
if (properties.userData) {
|
||||
try {
|
||||
results = JSON.parse(properties.userData);
|
||||
} catch(err) {
|
||||
logDebug(err);
|
||||
logDebug(properties.userData);
|
||||
}
|
||||
}
|
||||
return results ? results : {};
|
||||
}
|
||||
|
||||
|
||||
// Non-destructively modify the user data of an entity.
|
||||
setEntityCustomData = function(customKey, id, data) {
|
||||
var userData = getEntityUserData(id);
|
||||
if (data == null) {
|
||||
delete userData[customKey];
|
||||
} else {
|
||||
userData[customKey] = data;
|
||||
}
|
||||
setEntityUserData(id, userData);
|
||||
}
|
||||
|
||||
getEntityCustomData = function(customKey, id, defaultValue) {
|
||||
var userData = getEntityUserData(id);
|
||||
if (undefined != userData[customKey]) {
|
||||
return userData[customKey];
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
mergeObjects = function(proto, custom) {
|
||||
var result = {};
|
||||
for (var attrname in proto) {
|
||||
result[attrname] = proto[attrname];
|
||||
}
|
||||
for (var attrname in custom) {
|
||||
result[attrname] = custom[attrname];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
LOG_WARN = 1;
|
||||
|
||||
logWarn = function(str) {
|
||||
if (LOG_WARN) {
|
||||
print(str);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_ERROR = 1;
|
||||
|
||||
logError = function(str) {
|
||||
if (LOG_ERROR) {
|
||||
print(str);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO = 1;
|
||||
|
||||
logInfo = function(str) {
|
||||
if (LOG_INFO) {
|
||||
print(str);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG = 0;
|
||||
|
||||
logDebug = function(str) {
|
||||
if (LOG_DEBUG) {
|
||||
print(str);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_TRACE = 0;
|
||||
|
||||
logTrace = function(str) {
|
||||
if (LOG_TRACE) {
|
||||
print(str);
|
||||
}
|
||||
}
|
||||
|
||||
// Computes the penetration between a point and a sphere (centered at the origin)
|
||||
// if point is inside sphere: returns true and stores the result in 'penetration'
|
||||
// (the vector that would move the point outside the sphere)
|
||||
// otherwise returns false
|
||||
findSphereHit = function(point, sphereRadius) {
|
||||
var EPSILON = 0.000001; //smallish positive number - used as margin of error for some computations
|
||||
var vectorLength = Vec3.length(point);
|
||||
if (vectorLength < EPSILON) {
|
||||
return true;
|
||||
}
|
||||
var distance = vectorLength - sphereRadius;
|
||||
if (distance < 0.0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
findSpherePointHit = function(sphereCenter, sphereRadius, point) {
|
||||
return findSphereHit(Vec3.subtract(point,sphereCenter), sphereRadius);
|
||||
}
|
||||
|
||||
findSphereSphereHit = function(firstCenter, firstRadius, secondCenter, secondRadius) {
|
||||
return findSpherePointHit(firstCenter, firstRadius + secondRadius, secondCenter);
|
||||
}
|
||||
|
||||
// Given a vec3 v, return a vec3 that is the same vector relative to the avatars
|
||||
// DEFAULT eye position, rotated into the avatars reference frame.
|
||||
getEyeRelativePosition = function(v) {
|
||||
return Vec3.sum(MyAvatar.getDefaultEyePosition(), Vec3.multiplyQbyV(MyAvatar.orientation, v));
|
||||
}
|
||||
|
||||
getAvatarRelativeRotation = function(q) {
|
||||
return Quat.multiply(MyAvatar.orientation, q);
|
||||
}
|
||||
|
||||
pointInExtents = function(point, minPoint, maxPoint) {
|
||||
return (point.x >= minPoint.x && point.x <= maxPoint.x) &&
|
||||
(point.y >= minPoint.y && point.y <= maxPoint.y) &&
|
||||
(point.z >= minPoint.z && point.z <= maxPoint.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an HSL color value to RGB. Conversion formula
|
||||
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
|
||||
* Assumes h, s, and l are contained in the set [0, 1] and
|
||||
* returns r, g, and b in the set [0, 255].
|
||||
*
|
||||
* @param Number h The hue
|
||||
* @param Number s The saturation
|
||||
* @param Number l The lightness
|
||||
* @return Array The RGB representation
|
||||
*/
|
||||
hslToRgb = function(hsl) {
|
||||
var r, g, b;
|
||||
if (hsl.s == 0) {
|
||||
r = g = b = hsl.l; // achromatic
|
||||
} else {
|
||||
var hue2rgb = function hue2rgb(p, q, t) {
|
||||
if (t < 0) t += 1;
|
||||
if (t > 1) t -= 1;
|
||||
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
||||
if (t < 1 / 2) return q;
|
||||
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
||||
return p;
|
||||
}
|
||||
|
||||
var q = hsl.l < 0.5 ? hsl.l * (1 + hsl.s) : hsl.l + hsl.s - hsl.l * hsl.s;
|
||||
var p = 2 * hsl.l - q;
|
||||
r = hue2rgb(p, q, hsl.h + 1 / 3);
|
||||
g = hue2rgb(p, q, hsl.h);
|
||||
b = hue2rgb(p, q, hsl.h - 1 / 3);
|
||||
}
|
||||
|
||||
return {
|
||||
red: Math.round(r * 255),
|
||||
green: Math.round(g * 255),
|
||||
blue: Math.round(b * 255)
|
||||
};
|
||||
}
|
||||
|
||||
map = function(value, min1, max1, min2, max2) {
|
||||
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
|
||||
}
|
||||
|
||||
orientationOf = function(vector) {
|
||||
var Y_AXIS = {
|
||||
x: 0,
|
||||
y: 1,
|
||||
z: 0
|
||||
};
|
||||
var X_AXIS = {
|
||||
x: 1,
|
||||
y: 0,
|
||||
z: 0
|
||||
};
|
||||
|
||||
var theta = 0.0;
|
||||
|
||||
var RAD_TO_DEG = 180.0 / Math.PI;
|
||||
var direction, yaw, pitch;
|
||||
direction = Vec3.normalize(vector);
|
||||
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||
return Quat.multiply(yaw, pitch);
|
||||
}
|
||||
|
||||
randFloat = function(low, high) {
|
||||
return low + Math.random() * (high - low);
|
||||
}
|
||||
|
||||
|
||||
randInt = function(low, high) {
|
||||
return Math.floor(randFloat(low, high));
|
||||
}
|
||||
|
||||
|
||||
randomColor = function() {
|
||||
return {
|
||||
red: randInt(0, 255),
|
||||
green: randInt(0, 255),
|
||||
blue: randInt(0, 255)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hexToRgb = function(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
red: parseInt(result[1], 16),
|
||||
green: parseInt(result[2], 16),
|
||||
blue: parseInt(result[3], 16)
|
||||
} : null;
|
||||
}
|
||||
|
||||
calculateHandSizeRatio = function() {
|
||||
// Get the ratio of the current avatar's hand to Owen's hand
|
||||
|
||||
var standardCenterHandPoint = 0.11288;
|
||||
var jointNames = MyAvatar.getJointNames();
|
||||
//get distance from handJoint up to leftHandIndex3 as a proxy for center of hand
|
||||
var wristToFingertipDistance = 0;;
|
||||
for (var i = 0; i < jointNames.length; i++) {
|
||||
var jointName = jointNames[i];
|
||||
print(jointName)
|
||||
if (jointName.indexOf("LeftHandIndex") !== -1) {
|
||||
// translations are relative to parent joint, so simply add them together
|
||||
// joints face down the y-axis
|
||||
var translation = MyAvatar.getDefaultJointTranslation(i).y;
|
||||
wristToFingertipDistance += translation;
|
||||
}
|
||||
}
|
||||
// Right now units are in cm, so convert to meters
|
||||
wristToFingertipDistance /= 100;
|
||||
|
||||
var centerHandPoint = wristToFingertipDistance/2;
|
||||
|
||||
// Compare against standard hand (Owen)
|
||||
var handSizeRatio = centerHandPoint/standardCenterHandPoint;
|
||||
return handSizeRatio;
|
||||
}
|
||||
|
||||
clamp = function(val, min, max){
|
||||
return Math.max(min, Math.min(max, val))
|
||||
}
|
||||
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
(function() {
|
||||
var _this;
|
||||
var utilitiesScript = Script.resolvePath("../../libraries/utils.js");
|
||||
var utilitiesScript = Script.resolvePath("libraries/utils.js");
|
||||
Script.include(utilitiesScript);
|
||||
LightSwitch = function() {
|
||||
_this = this;
|
||||
this.switchSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/lamp_switch_2.wav");
|
||||
this.switchSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lamp_switch_2.wav");
|
||||
};
|
||||
|
||||
LightSwitch.prototype = {
|
||||
|
|
|
@ -6,25 +6,21 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
|
||||
//per script
|
||||
|
||||
|
||||
/*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */
|
||||
var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js");
|
||||
var utilitiesScript = Script.resolvePath("libraries/utils.js");
|
||||
Script.include(utilitiesScript);
|
||||
|
||||
var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js");
|
||||
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
||||
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
||||
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
||||
var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js');
|
||||
var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js");
|
||||
var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js");
|
||||
var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js");
|
||||
var bowScriptURL = Script.resolvePath("../examples/toybox/bow/bow.js");
|
||||
var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js");
|
||||
var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js');
|
||||
var gunScriptURL = Script.resolvePath("pistol/pistol.js");
|
||||
var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js");
|
||||
var catScriptURL = Script.resolvePath("cat/cat.js");
|
||||
var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js');
|
||||
var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js');
|
||||
var wandScriptURL = Script.resolvePath("bubblewand/wand.js");
|
||||
var dollScriptURL = Script.resolvePath("doll/doll.js");
|
||||
var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js");
|
||||
var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js');
|
||||
var bowScriptURL = Script.resolvePath('bow/bow.js');
|
||||
var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js");
|
||||
var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js');
|
||||
var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
||||
|
||||
|
@ -32,7 +28,6 @@ var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
|||
MasterReset = function() {
|
||||
var resetKey = "resetMe";
|
||||
|
||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var shouldDeleteOnEndScript = false;
|
||||
|
||||
|
@ -148,7 +143,7 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createRaveStick(position) {
|
||||
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx";
|
||||
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||
var stick = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -243,7 +238,7 @@ MasterReset = function() {
|
|||
alphaSpread: 0.1,
|
||||
alphaStart: 0.1,
|
||||
alphaFinish: 0.1,
|
||||
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png",
|
||||
emitterShouldTrail: false,
|
||||
userData: JSON.stringify({
|
||||
resetMe: {
|
||||
|
@ -254,7 +249,8 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createGun(position) {
|
||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
|
||||
|
||||
|
||||
var pistol = Entities.addEntity({
|
||||
type: 'Model',
|
||||
|
@ -281,7 +277,7 @@ MasterReset = function() {
|
|||
restitution: 0,
|
||||
dynamic: true,
|
||||
damping: 0.5,
|
||||
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
|
||||
userData: JSON.stringify({
|
||||
"wearable": {
|
||||
"joints": {
|
||||
|
@ -327,9 +323,8 @@ MasterReset = function() {
|
|||
|
||||
var SCRIPT_URL = Script.resolvePath('bow.js');
|
||||
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
|
||||
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
|
||||
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
|
||||
|
||||
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
|
||||
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
|
||||
var BOW_DIMENSIONS = {
|
||||
x: 0.04,
|
||||
y: 1.3,
|
||||
|
@ -480,7 +475,7 @@ MasterReset = function() {
|
|||
type: "ParticleEffect",
|
||||
name: "fire",
|
||||
animationSettings: animationSettings,
|
||||
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
||||
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png",
|
||||
position: {
|
||||
x: 551.45,
|
||||
y: 494.82,
|
||||
|
@ -544,10 +539,10 @@ MasterReset = function() {
|
|||
var DIAMETER = 0.30;
|
||||
var RESET_DISTANCE = 1;
|
||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
||||
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
||||
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
|
||||
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
|
||||
var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
|
||||
var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
|
||||
|
||||
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
||||
|
||||
|
@ -624,7 +619,7 @@ MasterReset = function() {
|
|||
z: 0
|
||||
},
|
||||
dynamic: true,
|
||||
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
|
||||
collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav',
|
||||
collisionless: false,
|
||||
modelURL: basketballURL,
|
||||
userData: JSON.stringify({
|
||||
|
@ -721,8 +716,8 @@ MasterReset = function() {
|
|||
function createTargets() {
|
||||
|
||||
|
||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||
|
||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||
var RESET_DISTANCE = 0.5;
|
||||
|
@ -801,8 +796,8 @@ MasterReset = function() {
|
|||
|
||||
function createCat(position) {
|
||||
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx";
|
||||
var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx";
|
||||
var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx";
|
||||
var animationSettings = JSON.stringify({
|
||||
running: true
|
||||
});
|
||||
|
@ -838,7 +833,7 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createFlashlight(position) {
|
||||
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
|
||||
|
||||
var flashlight = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -852,7 +847,7 @@ MasterReset = function() {
|
|||
z: 0.08
|
||||
},
|
||||
dynamic: true,
|
||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav",
|
||||
gravity: {
|
||||
x: 0,
|
||||
y: -3.5,
|
||||
|
@ -903,8 +898,7 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createLights() {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx";
|
||||
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx";
|
||||
|
||||
var rotation = {
|
||||
w: 0.63280689716339111,
|
||||
|
@ -1151,8 +1145,8 @@ MasterReset = function() {
|
|||
function createDice() {
|
||||
var diceProps = {
|
||||
type: "Model",
|
||||
modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx",
|
||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav",
|
||||
name: "dice",
|
||||
position: {
|
||||
x: 541.61,
|
||||
|
@ -1199,8 +1193,7 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createGates() {
|
||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx';
|
||||
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx';
|
||||
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
|
||||
var gate = Entities.addEntity({
|
||||
name: 'Front Door Fence',
|
||||
|
@ -1239,10 +1232,9 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createPingPongBallGun() {
|
||||
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||
|
||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
|
||||
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
|
||||
var position = {
|
||||
x: 548.6,
|
||||
y: 495.4,
|
||||
|
@ -1308,8 +1300,8 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createWand(position) {
|
||||
var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj';
|
||||
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
|
||||
|
||||
var wand = Entities.addEntity({
|
||||
name: 'Bubble Wand',
|
||||
|
@ -1369,7 +1361,7 @@ MasterReset = function() {
|
|||
|
||||
function createBasketBall(position) {
|
||||
|
||||
var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||
|
||||
var entity = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -1395,7 +1387,7 @@ MasterReset = function() {
|
|||
y: -0.01,
|
||||
z: 0
|
||||
},
|
||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav",
|
||||
userData: JSON.stringify({
|
||||
resetMe: {
|
||||
resetMe: true
|
||||
|
@ -1409,7 +1401,7 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createDoll(position) {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
|
||||
|
||||
var naturalDimensions = {
|
||||
x: 1.63,
|
||||
|
@ -1450,7 +1442,8 @@ MasterReset = function() {
|
|||
|
||||
function createSprayCan(position) {
|
||||
|
||||
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
|
||||
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx";
|
||||
|
||||
var entity = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -1464,7 +1457,7 @@ MasterReset = function() {
|
|||
z: 0.07
|
||||
},
|
||||
dynamic: true,
|
||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav",
|
||||
shapeType: 'box',
|
||||
gravity: {
|
||||
x: 0,
|
||||
|
@ -1490,7 +1483,7 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createPottedPlant(position) {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx";
|
||||
|
||||
var entity = Entities.addEntity({
|
||||
type: "Model",
|
||||
|
@ -1528,8 +1521,8 @@ MasterReset = function() {
|
|||
|
||||
|
||||
function createCombinedArmChair(position) {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx";
|
||||
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx";
|
||||
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj";
|
||||
|
||||
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
|
||||
|
||||
|
@ -1571,8 +1564,8 @@ MasterReset = function() {
|
|||
}
|
||||
|
||||
function createBlocks(position) {
|
||||
var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/";
|
||||
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
|
||||
var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/";
|
||||
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav";
|
||||
var NUM_BLOCKS_PER_COLOR = 4;
|
||||
var i, j;
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
var PLAYLIST_URL = "https://spreadsheets.google.com/feeds/cells/1x-ceGPGHldkHadARABFWfujLPTOWzXJPhrf2bTwg2cQ/od6/public/basic?alt=json";
|
||||
var SONG_VOLUME = 0.1;
|
||||
var HEADPHONES_ATTACHMENT = {
|
||||
modelURL: "https://s3.amazonaws.com/hifi-public/brad/musicplayer/headphones2-v2.fbx",
|
||||
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/musicPlayer/headphones2-v2.fbx",
|
||||
jointName: "Head",
|
||||
translation: {"x": 0, "y": 0.19, "z": 0.06},
|
||||
rotation: {"x":0,"y":0.7071067690849304,"z":0.7071067690849304,"w":0},
|
||||
|
|
|
@ -13,9 +13,9 @@ Script.include("../../libraries/utils.js");
|
|||
|
||||
var scriptURL = Script.resolvePath('pingPongGun.js');
|
||||
|
||||
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'
|
||||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx'
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
|
||||
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
|
||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||
x: 0,
|
||||
y: 0.5,
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
//
|
||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("utils.js");
|
||||
var scriptURL = Script.resolvePath('wallTarget.js');
|
||||
|
||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||
var RESET_DISTANCE = 0.5;
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||
(function() {
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("utils.js");
|
||||
|
||||
var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav';
|
||||
var PING_PONG_BALL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_ball.fbx';
|
||||
var SHOOTING_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/pong_sound.wav';
|
||||
var PING_PONG_BALL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/ping_pong_ball.fbx';
|
||||
|
||||
function PingPongGun() {
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
hasBecomeActive: false,
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
var SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/Clay_Pigeon_02.L.wav";
|
||||
var SOUND_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Clay_Pigeon_02.L.wav";
|
||||
this.hitSound = SoundCache.getSound(SOUND_URL);
|
||||
},
|
||||
collisionWithEntity: function(me, otherEntity) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation())));
|
||||
var scriptURL = Script.resolvePath('pistol.js');
|
||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
|
||||
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
|
||||
|
||||
|
||||
var pistol = Entities.addEntity({
|
||||
|
@ -27,7 +27,7 @@ var pistol = Entities.addEntity({
|
|||
},
|
||||
restitution: 0,
|
||||
damping:0.5,
|
||||
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
|
||||
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
|
||||
userData: JSON.stringify({
|
||||
grabbableKey: {
|
||||
invertSolidWhileHeld: true
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
|
||||
|
||||
(function() {
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("../../libraries/constants.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
var _this;
|
||||
var DISABLE_LASER_THRESHOLD = 0.2;
|
||||
|
@ -28,8 +27,8 @@
|
|||
this.forceMultiplier = 1;
|
||||
this.laserLength = 100;
|
||||
|
||||
this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
|
||||
this.ricochetSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/Ricochet.L.wav");
|
||||
this.fireSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/GUN-SHOT2.raw");
|
||||
this.ricochetSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/Ricochet.L.wav");
|
||||
this.playRichochetSoundChance = 0.1;
|
||||
this.fireVolume = 0.2;
|
||||
this.bulletForce = 10;
|
||||
|
@ -217,7 +216,7 @@
|
|||
"alphaStart": 0,
|
||||
"alphaFinish": 0,
|
||||
"additiveBlending": true,
|
||||
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
|
||||
"textures": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/star.png"
|
||||
});
|
||||
|
||||
Script.setTimeout(function() {
|
||||
|
@ -343,8 +342,8 @@
|
|||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
this.laser = Overlays.addOverlay("line3d", {
|
||||
start: ZERO_VECTOR,
|
||||
end: ZERO_VECTOR,
|
||||
start: { x: 0, y: 0, z: 0 },
|
||||
end: { x: 0, y: 0, z: 0 },
|
||||
color: COLORS.RED,
|
||||
alpha: 1,
|
||||
visible: true,
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
// Script.include("../libraries/utils.js");
|
||||
//Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge
|
||||
|
||||
Script.include("../../libraries/utils.js");
|
||||
Script.include("libraries/utils.js");
|
||||
|
||||
this.spraySound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/sprayPaintSound.wav");
|
||||
this.spraySound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/spray_paint.wav");
|
||||
|
||||
var TIP_OFFSET_Z = 0.02;
|
||||
var TIP_OFFSET_Y = 0.08;
|
||||
|
@ -63,7 +63,7 @@
|
|||
name: "streamEffect",
|
||||
isEmitting: true,
|
||||
position: position,
|
||||
textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png",
|
||||
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/smokeparticle.png",
|
||||
emitSpeed: 3,
|
||||
speedSpread: 0.02,
|
||||
emitAcceleration: ZERO_VEC,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
(function() {
|
||||
var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js');
|
||||
var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js');
|
||||
|
||||
var _this;
|
||||
Resetter = function() {
|
||||
|
@ -44,8 +44,8 @@
|
|||
|
||||
createTargets: function() {
|
||||
|
||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
||||
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||
|
||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||
var RESET_DISTANCE = 0.5;
|
Loading…
Reference in a new issue