mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44: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
|
||||
//
|
||||
(function() {
|
||||
|
||||
var BALL_DISTANCE_THRESHOLD;
|
||||
var _this;
|
||||
|
||||
function BallDetctor() {
|
||||
|
@ -22,14 +22,14 @@
|
|||
}
|
||||
|
||||
BallDetctor.prototype = {
|
||||
preload:function(entityID){
|
||||
this.entityID = entityID,
|
||||
this.maze = Entities.getEntityProperties(entityID,'parentID').parentID;
|
||||
},
|
||||
enterEntity: function() {
|
||||
print('BALL ENTERED BALL DETECTOR!!')
|
||||
},
|
||||
destroyBall: function() {
|
||||
|
||||
}
|
||||
createNewBall: function() {
|
||||
|
||||
Entities.callEntityMethod(this.maze,'destroyBall');
|
||||
Entities.callEntityMethod(this.maze,'createBall');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
var ball, ballSpawningAnchor, 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_HULL3.obj";
|
||||
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_HULL8.obj";
|
||||
var MAZE_SCRIPT = Script.resolvePath('maze.js?'+Math.random());
|
||||
var BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
||||
|
||||
|
||||
var MAZE_DIMENSIONS = {
|
||||
x: 1,
|
||||
y: 0.3,
|
||||
|
@ -17,6 +17,12 @@
|
|||
z: 0.05
|
||||
}
|
||||
|
||||
var BALL_SPAWNER_DIMENSIONS = {
|
||||
x: 0.05,
|
||||
y: 0.05,
|
||||
z: 0.05
|
||||
}
|
||||
|
||||
var BALL_DETECTOR_DIMENSIONS = {
|
||||
x: 1,
|
||||
y: 0.15,
|
||||
|
@ -106,6 +112,8 @@
|
|||
|
||||
ball = Entities.addEntity(properties);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
var createBallSpawningAnchor = function() {
|
||||
|
@ -114,7 +122,7 @@
|
|||
parentID: tiltMaze,
|
||||
type: 'Box',
|
||||
color: DEBUG_COLOR,
|
||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||
dimensions: BALL_SPAWNER_DIMENSIONS,
|
||||
position: getBallStartLocation(),
|
||||
collisionless: true,
|
||||
visible: true,
|
||||
|
@ -134,6 +142,7 @@
|
|||
position: position,
|
||||
rotiation: rotation,
|
||||
collisionless: true,
|
||||
dynamic:false,
|
||||
visible: true,
|
||||
script: BALL_DETECTOR_SCRIPT
|
||||
};
|
||||
|
@ -155,7 +164,8 @@
|
|||
angularDamping:MAZE_ANGULAR_DAMPING,
|
||||
rotation: Quat.fromPitchYawRollDegrees(0, 0, 180),
|
||||
dynamic: true,
|
||||
density: MAZE_DENSITY
|
||||
density: MAZE_DENSITY,
|
||||
script:MAZE_SCRIPT
|
||||
}
|
||||
|
||||
tiltMaze = Entities.addEntity(properties)
|
||||
|
@ -164,9 +174,17 @@
|
|||
|
||||
var createAll = function() {
|
||||
createTiltMaze(center);
|
||||
// createBallSpawningAnchor();
|
||||
createBallSpawningAnchor();
|
||||
// createBallDetector();
|
||||
createBall(center);
|
||||
createBall(center);
|
||||
Entities.editEntity(tiltMaze,{
|
||||
userData:JSON.stringify({
|
||||
tiltMaze:{
|
||||
firstBall:ball,
|
||||
ballSpawner:ballSpawningAnchor
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
createAll();
|
||||
|
|
Loading…
Reference in a new issue