mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-12 17:42:39 +02:00
updatez
This commit is contained in:
parent
979c2feeb0
commit
355f25bb8f
2 changed files with 57 additions and 24 deletions
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
(function() {
|
||||
|
||||
var _this;
|
||||
var _this;
|
||||
|
||||
function BallDetctor() {
|
||||
_this = this;
|
||||
|
@ -22,15 +22,15 @@
|
|||
}
|
||||
|
||||
BallDetctor.prototype = {
|
||||
enterEntity:function(){
|
||||
print('BALL ENTERED BALL DETECTOR!!')
|
||||
},
|
||||
destroyBall:function(){
|
||||
enterEntity: function() {
|
||||
print('BALL ENTERED BALL DETECTOR!!')
|
||||
},
|
||||
destroyBall: function() {
|
||||
|
||||
}
|
||||
createNewBall:function(){
|
||||
}
|
||||
createNewBall: function() {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return new BallDetctor();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var ball, ballDetector, tiltMaze;
|
||||
var MAZE_MODEL_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE2.fbx";
|
||||
var MAZE_COLLISION_HULL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE_COLLISION_HULL.obj";
|
||||
var MAZE_COLLISION_HULL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE_COLLISION_HULL3.obj";
|
||||
var BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
||||
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
|||
};
|
||||
|
||||
var BALL_DIMENSIONS = {
|
||||
x: 0.1,
|
||||
y: 0.1,
|
||||
z: 0.1
|
||||
x: 0.025,
|
||||
y: 0.025,
|
||||
z: 0.025
|
||||
}
|
||||
var BALL_COLOR = {
|
||||
red: 255,
|
||||
|
@ -27,64 +27,97 @@
|
|||
blue: 0
|
||||
}
|
||||
|
||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||
x: 0,
|
||||
y: 0.5,
|
||||
z: 0
|
||||
}), Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation())));
|
||||
|
||||
var CLEANUP = true;
|
||||
|
||||
var createBall = function(position) {
|
||||
var mazeProps = Entities.getEntityProperties(tiltMaze);
|
||||
var right = Quat.getRight(mazeProps.rotation);
|
||||
var front = Quat.getFront(mazeProps.rotation);
|
||||
var offset = {
|
||||
x:0,
|
||||
y:0.02,
|
||||
z:0
|
||||
};
|
||||
|
||||
var finalOffset = Vec3.sum(offset,Vec3.multiply(right,-0.4));
|
||||
finalOffset = Vec3.sum(finalOffset,Vec3.multiply(front,-0.2));
|
||||
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze Ball'
|
||||
name: 'Hifi Tilt Maze Ball',
|
||||
type: 'Sphere',
|
||||
shapeType: 'sphere',
|
||||
dimensions: BALL_DIMENSIONS,
|
||||
color: BALL_COLOR,
|
||||
position: position
|
||||
position: Vec3.sum(position,finalOffset),
|
||||
dynamic: true,
|
||||
collisionless:false,
|
||||
damping:0.6,
|
||||
|
||||
};
|
||||
ball = Entities.addEntity(properties);
|
||||
};
|
||||
|
||||
var createBallSpawningAnchor: function() {
|
||||
var createBallSpawningAnchor = function(position) {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze Ball Detector'
|
||||
name: 'Hifi Tilt Maze Ball Detector',
|
||||
parentID: tiltMaze,
|
||||
type: 'Box',
|
||||
color: DEBUG_COLOR,
|
||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||
position: position,
|
||||
rotiation: rotation,
|
||||
position: center,
|
||||
collisionless: true,
|
||||
visible: true,
|
||||
script: BALL_DETECTOR_SCRIPT
|
||||
};
|
||||
}
|
||||
|
||||
var createBallDetector = function(position, rotation) {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze Ball Detector'
|
||||
name: 'Hifi Tilt Maze Ball Detector',
|
||||
parentID: tiltMaze,
|
||||
type: 'Box',
|
||||
color: DEBUG_COLOR,
|
||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||
position: position,
|
||||
rotiation: rotation,
|
||||
collisionless: true,
|
||||
visible: true,
|
||||
script: BALL_DETECTOR_SCRIPT
|
||||
};
|
||||
ballDetector = Entities.addEntity(properties);
|
||||
};
|
||||
|
||||
var createTiltMaze: function(position, rotation) {
|
||||
var createTiltMaze = function(position) {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze',
|
||||
type: 'Model',
|
||||
modelURL: MAZE_MODEL_URL,
|
||||
compoundShapeURL: MAZE_COLLISION_HULL,
|
||||
dimensions: MAZE_DIMENSIONS,
|
||||
position: position,
|
||||
rotation: rotation,
|
||||
rotation: Quat.fromPitchYawRollDegrees(0, 0, 180),
|
||||
dynamic: true,
|
||||
}
|
||||
tiltMaze = Entities.addEntity(properties)
|
||||
}
|
||||
|
||||
var createAll = function() {
|
||||
createTiltMaze();
|
||||
createTiltMaze(center);
|
||||
// createBallDetector();
|
||||
// createBall();
|
||||
createBall(center);
|
||||
}
|
||||
|
||||
createAll();
|
||||
createAll();
|
||||
|
||||
if (CLEANUP === true) {
|
||||
Script.scriptEnding.connect(function() {
|
||||
Entities.deleteEntity(tiltMaze);
|
||||
Entities.deleteEntity(ball);
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue