mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
tiltmaze
This commit is contained in:
parent
376c23f1a3
commit
979c2feeb0
3 changed files with 207 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// ballDetector.js
|
||||
//
|
||||
// Script Type: Entity
|
||||
//
|
||||
// Created by James B. Pollack @imgntn on 2/15/2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
//
|
||||
// This script resets a ball to its original position when the ball enters it.
|
||||
//
|
||||
// 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;
|
||||
|
||||
function BallDetctor() {
|
||||
_this = this;
|
||||
return;
|
||||
}
|
||||
|
||||
BallDetctor.prototype = {
|
||||
enterEntity:function(){
|
||||
print('BALL ENTERED BALL DETECTOR!!')
|
||||
},
|
||||
destroyBall:function(){
|
||||
|
||||
}
|
||||
createNewBall:function(){
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
return new BallDetctor();
|
||||
});
|
|
@ -0,0 +1,90 @@
|
|||
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 BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
||||
|
||||
|
||||
var MAZE_DIMENSIONS = {
|
||||
x: 1,
|
||||
y: 0.3,
|
||||
z: 1
|
||||
};
|
||||
|
||||
var BALL_DIMENSIONS = {
|
||||
x: 0.1,
|
||||
y: 0.1,
|
||||
z: 0.1
|
||||
}
|
||||
var BALL_COLOR = {
|
||||
red: 255,
|
||||
green: 0,
|
||||
blue: 0
|
||||
}
|
||||
|
||||
var DEBUG_COLOR = {
|
||||
red: 0,
|
||||
green: 255,
|
||||
blue: 0
|
||||
}
|
||||
|
||||
|
||||
var createBall = function(position) {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze Ball'
|
||||
type: 'Sphere',
|
||||
shapeType: 'sphere',
|
||||
dimensions: BALL_DIMENSIONS,
|
||||
color: BALL_COLOR,
|
||||
position: position
|
||||
dynamic: true,
|
||||
};
|
||||
ball = Entities.addEntity(properties);
|
||||
};
|
||||
|
||||
var createBallSpawningAnchor: function() {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze Ball Detector'
|
||||
parentID: tiltMaze,
|
||||
type: 'Box',
|
||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||
position: position,
|
||||
rotiation: rotation,
|
||||
collisionless: true,
|
||||
script: BALL_DETECTOR_SCRIPT
|
||||
};
|
||||
}
|
||||
|
||||
var createBallDetector = function(position, rotation) {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze Ball Detector'
|
||||
parentID: tiltMaze,
|
||||
type: 'Box',
|
||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||
position: position,
|
||||
rotiation: rotation,
|
||||
collisionless: true,
|
||||
script: BALL_DETECTOR_SCRIPT
|
||||
};
|
||||
ballDetector = Entities.addEntity(properties);
|
||||
};
|
||||
|
||||
var createTiltMaze: function(position, rotation) {
|
||||
var properties = {
|
||||
name: 'Hifi Tilt Maze',
|
||||
type: 'Model',
|
||||
compoundShapeURL: MAZE_COLLISION_HULL,
|
||||
dimensions: MAZE_DIMENSIONS,
|
||||
position: position,
|
||||
rotation: rotation,
|
||||
dynamic: true,
|
||||
}
|
||||
tiltMaze = Entities.addEntity(properties)
|
||||
}
|
||||
|
||||
var createAll = function() {
|
||||
createTiltMaze();
|
||||
// createBallDetector();
|
||||
// createBall();
|
||||
}
|
||||
|
||||
createAll();
|
80
unpublishedScripts/DomainContent/Home/tiltMaze/tiltMaze.js
Normal file
80
unpublishedScripts/DomainContent/Home/tiltMaze/tiltMaze.js
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// tiltMaze.js
|
||||
//
|
||||
// Script Type: Entity
|
||||
//
|
||||
// Created by James B. Pollack @imgntn on 2/15/2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
//
|
||||
// This is the entity script for a tilt maze. It create a ball when you grab it, which you have a set amount of time to get through the hole
|
||||
//
|
||||
// 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 COLLISION_HULL = "";
|
||||
var MAZE_MODEL = "";
|
||||
var LENGTH_OF_GAME = 60;
|
||||
|
||||
var BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
||||
var _this;
|
||||
|
||||
function TiltMaze() {
|
||||
_this = this;
|
||||
return;
|
||||
}
|
||||
|
||||
TiltMaze.prototype = {
|
||||
hasBall: false,
|
||||
hand: null,
|
||||
startNearGrab: function(entityID, args) {
|
||||
this.hand = args[0];
|
||||
|
||||
},
|
||||
releaseGrab: function() {
|
||||
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
},
|
||||
|
||||
createBall: function(position) {
|
||||
var properties = {
|
||||
type: 'Sphere',
|
||||
shapeType: 'sphere',
|
||||
dimensions: BALL_DIMENSIONS,
|
||||
color: BALL_COLOR,
|
||||
position: position
|
||||
};
|
||||
this.ball = Entities.addEntity(properties);
|
||||
},
|
||||
|
||||
createBallDetector: function(position, rotation) {
|
||||
var properties = {
|
||||
parentID: this.entityID,
|
||||
type: 'Box',
|
||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||
position: position,
|
||||
rotiation: rotation,
|
||||
collisionless: true,
|
||||
script: BALL_DETECTOR_SCRIPT
|
||||
};
|
||||
this.ballDetector = Entities.addEntity(properties);
|
||||
},
|
||||
|
||||
destroyBall: function() {
|
||||
Entities.deleteEntity(this.ball);
|
||||
}
|
||||
|
||||
unload: function() {
|
||||
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
return new TiltMaze();
|
||||
});
|
Loading…
Reference in a new issue