Javascript-форум (https://javascript.ru/forum/)
-   Элементы интерфейса (https://javascript.ru/forum/dom-window/)
-   -   Неработает позиция по координатам (https://javascript.ru/forum/dom-window/44484-nerabotaet-poziciya-po-koordinatam.html)

avrudoi 21.01.2014 20:11

Неработает позиция по координатам
 
Неподниманиться позиция по y,
text.position.set = (-50* Math.cos(text.rotation.y), 0, 50* Math.sin(text.rotation.y));

как я понимаю что set(x,y,x), так понимаю должно быть.

alexan0308 21.01.2014 20:21

Цитата:

Сообщение от avrudoi (Сообщение 293317)
Неподниманиться позиция по y,

какой то ты не русский

Цитата:

Сообщение от avrudoi (Сообщение 293317)
text.position.set = (-50* Math.cos(text.rotation.y), 0, 50* Math.sin(text.rotation.y));

как я понимаю что set(x,y,x), так понимаю должно быть.

text.position.set = (-50* Math.cos(text.rotation.y), 10, 50* Math.sin(text.rotation.y));

avrudoi 21.01.2014 20:43

я уже пробывал.

avrudoi 21.01.2014 20:46

:D

alexan0308 21.01.2014 21:14

Цитата:

Сообщение от avrudoi (Сообщение 293317)
Неподниманиться позиция по y,
text.position.set = (-50* Math.cos(text.rotation.y), 0, 50* Math.sin(text.rotation.y));

как я понимаю что set(x,y,x), так понимаю должно быть.

Убери равно
text.position.set(-50* Math.cos(text.rotation.y), 10, 50* Math.sin(text.rotation.y));

Когда ты его успел засунуть

avrudoi 21.01.2014 21:17

парюсь

avrudoi 21.01.2014 21:46

подскажите символы перевода каретки на другую строку

alexan0308 21.01.2014 22:00

Цитата:

Сообщение от avrudoi (Сообщение 293328)
что то не то текст после, после добавления, остальных позийци меню сдвинулся, нихрена непонимаю координаты пляшут.

text.position.set(-50* Math.cos(text.rotation.y), 40, 50* Math.sin(text.rotation.y));

cube1.position.set(-50* Math.cos(cube1.rotation.y), 0, 50* Math.sin(cube1.rotation.y));
должно накладываться, друг на друга, раньше когда бы только одна надпись, все было в порядке, когда добавил остальные позиции, он сдвинулся по координате, x или y.
вот код
projector = new THREE.Projector(), objects = [];
megalit = new THREE.Object3D();
container = document.createElement( 'div' );
document.body.appendChild( container );
...

Люди должны сами догадаться, что ты оставил сверху от кода, а что снизу?

Цитата:

Сообщение от avrudoi (Сообщение 293328)
if (M_J=1){
menu = "Фаваритки";
}
else{
menu = "Фавариты";
}

Фаварит пишется через о - Фаворит :haha:

avrudoi 21.01.2014 23:07

я щас дабавлю код, а как символ перевода каретки добавить

avrudoi 21.01.2014 23:09

function init() {
projector = new THREE.Projector(), objects = [];
megalit = new THREE.Object3D();
container = document.createElement( 'div' );
document.body.appendChild( container );

var info = document.createElement( 'div' );
info.style.position = 'absolute';
info.style.top = '10px';
info.style.width = '100%';
info.style.textAlign = 'center';
info.innerHTML = 'Drag to spin the cube';
container.appendChild( info );

camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.y = 150;
camera.position.z = 500;

scene = new THREE.Scene();


var menu = "Подарки";
var menu_text = new THREE.TextGeometry( menu, {

size: 14,
height: 5,
curveSegments: 2,
font: "arial"
});
menu_text.computeBoundingBox();
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
var text = new THREE.Mesh( menu_text, textMaterial );
text.rotation.y = 60 * Math.PI/180;
text.position.set(10* Math.cos(text.rotation.y), 120, -10* Math.sin(text.rotation.y));
var text1=text;

var menu = "Счет";
menu_text = new THREE.TextGeometry( menu, {

size: 14,
height: 5,
curveSegments: 2,
font: "arial"
});
menu_text.computeBoundingBox();
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
var text = new THREE.Mesh( menu_text, textMaterial );
text.rotation.y = 60 * Math.PI/180;
text.position.set(10* Math.cos(text.rotation.y), 95, -10* Math.sin(text.rotation.y));
var text2 = text;

var menu = "Выход";
var menu_text = new THREE.TextGeometry( menu, {

size: 14,
height: 5,
curveSegments: 2,
font: "arial"
});
menu_text.computeBoundingBox();
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
var text = new THREE.Mesh( menu_text, textMaterial );
text.rotation.y = 60 * Math.PI/180;
text.position.set(10* Math.cos(text.rotation.y), 70, -10* Math.sin(text.rotation.y));
var text3 = text;

var menu = "Новое сообщение";
var menu_text = new THREE.TextGeometry( menu, {

size: 14,
height: 5,
curveSegments: 2,
font: "arial"
});
menu_text.computeBoundingBox();
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
var text = new THREE.Mesh( menu_text, textMaterial );
text.rotation.y = 180 * Math.PI/180;
text.position.set(10* Math.cos(text.rotation.y), 120, -10* Math.sin(text.rotation.y));
var text4 = text;

var menu = "Список сообщений";
var menu_text = new THREE.TextGeometry( menu, {

size: 14,
height: 5,
curveSegments: 2,
font: "arial"
});
menu_text.computeBoundingBox();
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
var text = new THREE.Mesh( menu_text, textMaterial );
text.rotation.y = 180 * Math.PI/180;
text.position.set(10* Math.cos(text.rotation.y), 95, -10* Math.sin(text.rotation.y));
var text5 = text;

var menu;
if (M_J=1){
menu = "Фаваритки";
}
else{
menu = "Фавориты";
}

var menu_text = new THREE.TextGeometry( menu, {

size: 14,
height: 5,
curveSegments: 2,
font: "arial"
});
menu_text.computeBoundingBox();
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
var text = new THREE.Mesh( menu_text, textMaterial );
text.rotation.y = 180 * Math.PI/180;
text.position.set(10* Math.cos(text.rotation.y), 70, 10* Math.sin(text.rotation.y));
var text6 = text;

// Cube
var geometry = new THREE.CubeGeometry( 110, 300, 5 );

var material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, opacity: 0.5, transparent: true });

cube1 = new THREE.Mesh( geometry, material );
cube1.rotation.y = 120 * Math.PI/180;
cube1.position.set(-50* Math.cos(cube1.rotation.y), 0, 50* Math.sin(cube1.rotation.y));

var material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, opacity: 0.5, transparent: true });

cube2 = new THREE.Mesh( geometry, material );
cube2.rotation.y = 240 * Math.PI/180;
cube2.position.set(-50* Math.cos(cube2.rotation.y), 0, 50* Math.sin(cube2.rotation.y));

var material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, opacity: 0.5, transparent: true });

cube3 = new THREE.Mesh( geometry, material );
cube3.rotation.y = 360 * Math.PI/180;
cube3.position.set(-50* Math.cos(cube3.rotation.y), 0, 50* Math.sin(cube3.rotation.y));

// для прорисовки

megalit.add(cube1);
megalit.add(cube2);
megalit.add(cube3);
megalit.add(text1);
megalit.add(text2);
megalit.add(text3);
megalit.add(text4);
megalit.add(text5);
megalit.add(text6);
// добавление текста
scene.add( megalit );
// для выбора

objects.push(cube1);
objects.push(cube2);
objects.push(cube3);
objects.push(text1);
objects.push(text2);
objects.push(text3);
objects.push(text4);
objects.push(text5);
objects.push(text6);


Часовой пояс GMT +3, время: 05:20.