mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:06:57 +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() {
|
(function() {
|
||||||
|
|
||||||
var _this;
|
var _this;
|
||||||
|
|
||||||
function BallDetctor() {
|
function BallDetctor() {
|
||||||
_this = this;
|
_this = this;
|
||||||
|
@ -22,15 +22,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
BallDetctor.prototype = {
|
BallDetctor.prototype = {
|
||||||
enterEntity:function(){
|
enterEntity: function() {
|
||||||
print('BALL ENTERED BALL DETECTOR!!')
|
print('BALL ENTERED BALL DETECTOR!!')
|
||||||
},
|
},
|
||||||
destroyBall:function(){
|
destroyBall: function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
createNewBall:function(){
|
createNewBall: function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return new BallDetctor();
|
return new BallDetctor();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var ball, ballDetector, tiltMaze;
|
var ball, 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/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())
|
var BALL_DETECTOR_SCRIPT = Script.resolvePath('ballDetector.js?' + Math.random())
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var BALL_DIMENSIONS = {
|
var BALL_DIMENSIONS = {
|
||||||
x: 0.1,
|
x: 0.025,
|
||||||
y: 0.1,
|
y: 0.025,
|
||||||
z: 0.1
|
z: 0.025
|
||||||
}
|
}
|
||||||
var BALL_COLOR = {
|
var BALL_COLOR = {
|
||||||
red: 255,
|
red: 255,
|
||||||
|
@ -27,64 +27,97 @@
|
||||||
blue: 0
|
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 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 = {
|
var properties = {
|
||||||
name: 'Hifi Tilt Maze Ball'
|
name: 'Hifi Tilt Maze Ball',
|
||||||
type: 'Sphere',
|
type: 'Sphere',
|
||||||
shapeType: 'sphere',
|
shapeType: 'sphere',
|
||||||
dimensions: BALL_DIMENSIONS,
|
dimensions: BALL_DIMENSIONS,
|
||||||
color: BALL_COLOR,
|
color: BALL_COLOR,
|
||||||
position: position
|
position: Vec3.sum(position,finalOffset),
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
|
collisionless:false,
|
||||||
|
damping:0.6,
|
||||||
|
|
||||||
};
|
};
|
||||||
ball = Entities.addEntity(properties);
|
ball = Entities.addEntity(properties);
|
||||||
};
|
};
|
||||||
|
|
||||||
var createBallSpawningAnchor: function() {
|
var createBallSpawningAnchor = function(position) {
|
||||||
var properties = {
|
var properties = {
|
||||||
name: 'Hifi Tilt Maze Ball Detector'
|
name: 'Hifi Tilt Maze Ball Detector',
|
||||||
parentID: tiltMaze,
|
parentID: tiltMaze,
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
|
color: DEBUG_COLOR,
|
||||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||||
position: position,
|
position: center,
|
||||||
rotiation: rotation,
|
|
||||||
collisionless: true,
|
collisionless: true,
|
||||||
|
visible: true,
|
||||||
script: BALL_DETECTOR_SCRIPT
|
script: BALL_DETECTOR_SCRIPT
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var createBallDetector = function(position, rotation) {
|
var createBallDetector = function(position, rotation) {
|
||||||
var properties = {
|
var properties = {
|
||||||
name: 'Hifi Tilt Maze Ball Detector'
|
name: 'Hifi Tilt Maze Ball Detector',
|
||||||
parentID: tiltMaze,
|
parentID: tiltMaze,
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
|
color: DEBUG_COLOR,
|
||||||
dimensions: BALL_DETECTOR_DIMENSIONS,
|
dimensions: BALL_DETECTOR_DIMENSIONS,
|
||||||
position: position,
|
position: position,
|
||||||
rotiation: rotation,
|
rotiation: rotation,
|
||||||
collisionless: true,
|
collisionless: true,
|
||||||
|
visible: true,
|
||||||
script: BALL_DETECTOR_SCRIPT
|
script: BALL_DETECTOR_SCRIPT
|
||||||
};
|
};
|
||||||
ballDetector = Entities.addEntity(properties);
|
ballDetector = Entities.addEntity(properties);
|
||||||
};
|
};
|
||||||
|
|
||||||
var createTiltMaze: function(position, rotation) {
|
var createTiltMaze = function(position) {
|
||||||
var properties = {
|
var properties = {
|
||||||
name: 'Hifi Tilt Maze',
|
name: 'Hifi Tilt Maze',
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
|
modelURL: MAZE_MODEL_URL,
|
||||||
compoundShapeURL: MAZE_COLLISION_HULL,
|
compoundShapeURL: MAZE_COLLISION_HULL,
|
||||||
dimensions: MAZE_DIMENSIONS,
|
dimensions: MAZE_DIMENSIONS,
|
||||||
position: position,
|
position: position,
|
||||||
rotation: rotation,
|
rotation: Quat.fromPitchYawRollDegrees(0, 0, 180),
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
}
|
}
|
||||||
tiltMaze = Entities.addEntity(properties)
|
tiltMaze = Entities.addEntity(properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
var createAll = function() {
|
var createAll = function() {
|
||||||
createTiltMaze();
|
createTiltMaze(center);
|
||||||
// createBallDetector();
|
// 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