|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function build_scene()
{
clock = new THREE.Clock();
// load 3d objects
load_object_json("monster.js", true, {ath:+30, atv:+15, depth:500, scale:0.1, rx:180, ry:60 ,rz:0, ondown:function(obj){ obj.properties.scale *= 1.2; update_object_properties(obj); }, onup:function(obj){ obj.properties.scale /= 1.2; update_object_properties(obj); }});
load_object_json("flamingo.js", true, {ath:-110, atv:-20, depth:700, scale:1.0, rx:-10, ry:250, rz:180, ondown:function(obj){ obj.properties.scale *= 1.2; update_object_properties(obj); }, onup:function(obj){ obj.properties.scale /= 1.2; update_object_properties(obj); }});
load_object_json("horse.js", true, {ath:-58, atv:+7, depth:1000, scale:1.0, rx:180, ry:233, rz:0, ondown:function(obj){ obj.properties.scale *= 1.2; update_object_properties(obj); }, onup:function(obj){ obj.properties.scale /= 1.2; update_object_properties(obj); }}, function(obj){ obj.material.color.setHex(0xAA5522); } );
// create a textured 3d box
box = new THREE.Mesh(new THREE.BoxGeometry(500,500,500), new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture(resolve_url_path("box.jpg"))}));
assign_object_properties(box, "box", {ath:160, atv:-3, depth:2000, ondown:function(obj){ obj.properties.scale *= 1.2; }, onup:function(obj){ obj.properties.scale /= 1.2; }});
scene.add( box );
// add scene lights
scene.add( new THREE.AmbientLight(0x333333) );
var directionalLight = new THREE.DirectionalLight(0xFFFFFF);
directionalLight.position.x = 0.5;
directionalLight.position.y = -1;
directionalLight.position.z = 0;
directionalLight.position.normalize();
scene.add( directionalLight );
}
|
|
|
Quellcode |
1 |
onclick: function loadpano(){krpano.call("openurl(http://www.krpano.com,_blank));");},
|
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comBenutzerinformationen überspringen
Beruf: krpano freelancer || creating ideas & coding them || krpano developer
Hi Tittu, do you find the answer on your question, i also like to know is it possible to onover to an 3d object in vr mode. anyone know this?Is there any way to "click" in VR mode? I try to use onover, but the result is random... The reticle seems to go behind the 3D object.
The result should look like this: http://neuman.github.io/vreticle/ Hi
Did you have any luck assigning the three.js obj the vtmh_trackinghtspstyle timeline?Hi,
Yes i am sure it is..
I had a try already but got stuck..
I had problem to get the ath (etc) from krpano or other js to the object.
(had already the flamingo flying in 360 video with some small actions but ..
Also too busy right now.. I could use some js help to access the object.
Maybe small example.
Tuur![]()
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

: https://pame.virtualtuur.com|
|
Quellcode |
1 2 3 4 5 6 7 8 |
copy(obj, plugin[threejs].obj[3D/LONDON/LONDON.js]);
set(obj.properties.ath, 14.5); set(obj.properties.atv, 21.5); set(obj.properties.depth, 270); set(obj.properties.scale, 0.7);
set(obj.properties.rx, 0); set(obj.properties.ry, 130.0); set(obj.properties.rz, 180);
trace('OBJ.PROP.NAME : ', obj.properties.name);
trace('OBJ.PROP.ATH : ', obj.properties.ath);
plugin[threejs].update_object_properties(get(obj));
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
function load_object_json(url, animated, properties, donecall)
{
var nm = url;
url = resolve_url_path(url);
var loader = new THREE.JSONLoader();
loader.load(url, function (geometry, materials)
{
///var material = materials[0];
if (animated)
{
///material.morphTargets = true;
///material.morphNormals = true;
for (key in materials) { // Example from: http://stackoverflow.com/questions/9329446/for-each-over-an-array-in-javascript
if (materials.hasOwnProperty(key) && // These are explained
/^0$|^[1-9]\d*$/.test(key) && // and then hidden
key <= 4294967294 // away below
) {
materials[key].morphTargets = true;
materials[key].morphNormals = true;
}
}
geometry.computeMorphNormals();
}
var material = new THREE.MeshFaceMaterial( materials );
geometry.computeVertexNormals();
var obj = new THREE.MorphAnimMesh(geometry, material);
if (animated)
{
obj.duration = 5000;
obj.time = 0;
obj.matrixAutoUpdate = false;
animatedobjects.push(obj);
}
assign_object_properties(obj, url, properties);
krpano.set("plugin[threejs].obj[" + nm + "]", obj);
scene.add( obj );
if (donecall)
{
donecall(obj);
}
});
}
|
|
|
Quellcode |
1 |
krpano.set("plugin[threejs].update_object_properties", update_object_properties);
|