mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:28:02 +02:00
working with destroy etc;
This commit is contained in:
parent
75b17bc1cd
commit
380ddf8b47
2 changed files with 32 additions and 14 deletions
|
@ -13,7 +13,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
(function() {
|
(function() {
|
||||||
|
var BALL_DISTANCE_THRESHOLD;
|
||||||
var _this;
|
var _this;
|
||||||
|
|
||||||
function BallDetctor() {
|
function BallDetctor() {
|
||||||
|
@ -22,14 +22,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
BallDetctor.prototype = {
|
BallDetctor.prototype = {
|
||||||
|
preload:function(entityID){
|
||||||
|
this.entityID = entityID,
|
||||||
|
this.maze = Entities.getEntityProperties(entityID,'parentID').parentID;
|
||||||
|
},
|
||||||
enterEntity: function() {
|
enterEntity: function() {
|
||||||
print('BALL ENTERED BALL DETECTOR!!')
|
print('BALL ENTERED BALL DETECTOR!!')
|
||||||
},
|
Entities.callEntityMethod(this.maze,'destroyBall');
|
||||||
destroyBall: function() {
|
Entities.callEntityMethod(this.maze,'createBall');
|
||||||
|
|
||||||
}
|
|
||||||
createNewBall: function() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
var ball, ballSpawningAnchor, ballDetector, tiltMaze;
|
var ball, ballSpawningAnchor, ballDetector, tiltMaze;
|
||||||
|
|
||||||
var MAZE_MODEL_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE2.fbx";
|
var MAZE_MODEL_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE3.fbx";
|
||||||
var MAZE_COLLISION_HULL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE_COLLISION_HULL3.obj";
|
var MAZE_COLLISION_HULL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/MAZE_COLLISION_HULL8.obj";
|
||||||
|
var MAZE_SCRIPT = Script.resolvePath('maze.js?'+Math.random());
|
||||||
var BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
var BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
||||||
|
|
||||||
|
|
||||||
var MAZE_DIMENSIONS = {
|
var MAZE_DIMENSIONS = {
|
||||||
x: 1,
|
x: 1,
|
||||||
y: 0.3,
|
y: 0.3,
|
||||||
|
@ -17,6 +17,12 @@
|
||||||
z: 0.05
|
z: 0.05
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var BALL_SPAWNER_DIMENSIONS = {
|
||||||
|
x: 0.05,
|
||||||
|
y: 0.05,
|
||||||
|
z: 0.05
|
||||||
|
}
|
||||||
|
|
||||||
var BALL_DETECTOR_DIMENSIONS = {
|
var BALL_DETECTOR_DIMENSIONS = {
|
||||||
x: 1,
|
x: 1,
|
||||||
y: 0.15,
|
y: 0.15,
|
||||||
|
@ -106,6 +112,8 @@
|
||||||
|
|
||||||
ball = Entities.addEntity(properties);
|
ball = Entities.addEntity(properties);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var createBallSpawningAnchor = function() {
|
var createBallSpawningAnchor = function() {
|
||||||
|
@ -114,7 +122,7 @@
|
||||||
parentID: tiltMaze,
|
parentID: tiltMaze,
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
color: DEBUG_COLOR,
|
color: DEBUG_COLOR,
|
||||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
dimensions: BALL_SPAWNER_DIMENSIONS,
|
||||||
position: getBallStartLocation(),
|
position: getBallStartLocation(),
|
||||||
collisionless: true,
|
collisionless: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
|
@ -134,6 +142,7 @@
|
||||||
position: position,
|
position: position,
|
||||||
rotiation: rotation,
|
rotiation: rotation,
|
||||||
collisionless: true,
|
collisionless: true,
|
||||||
|
dynamic:false,
|
||||||
visible: true,
|
visible: true,
|
||||||
script: BALL_DETECTOR_SCRIPT
|
script: BALL_DETECTOR_SCRIPT
|
||||||
};
|
};
|
||||||
|
@ -155,7 +164,8 @@
|
||||||
angularDamping:MAZE_ANGULAR_DAMPING,
|
angularDamping:MAZE_ANGULAR_DAMPING,
|
||||||
rotation: Quat.fromPitchYawRollDegrees(0, 0, 180),
|
rotation: Quat.fromPitchYawRollDegrees(0, 0, 180),
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
density: MAZE_DENSITY
|
density: MAZE_DENSITY,
|
||||||
|
script:MAZE_SCRIPT
|
||||||
}
|
}
|
||||||
|
|
||||||
tiltMaze = Entities.addEntity(properties)
|
tiltMaze = Entities.addEntity(properties)
|
||||||
|
@ -164,9 +174,17 @@
|
||||||
|
|
||||||
var createAll = function() {
|
var createAll = function() {
|
||||||
createTiltMaze(center);
|
createTiltMaze(center);
|
||||||
// createBallSpawningAnchor();
|
createBallSpawningAnchor();
|
||||||
// createBallDetector();
|
// createBallDetector();
|
||||||
createBall(center);
|
createBall(center);
|
||||||
|
Entities.editEntity(tiltMaze,{
|
||||||
|
userData:JSON.stringify({
|
||||||
|
tiltMaze:{
|
||||||
|
firstBall:ball,
|
||||||
|
ballSpawner:ballSpawningAnchor
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
createAll();
|
createAll();
|
||||||
|
|
Loading…
Reference in a new issue