문제

나는 그 순간에 VRML로 놀고 있으며, 솔직히 말하지 만, 웹 3D 프로젝트에 대한 프로젝트가 아닙니다.

웹 페이지에서 DIV를 표시하고 숨길 수있는 VRML에서 터치 센서를 만들려고합니다.를 사용하여 WEE 스크립트 작성을 시도했습니다.

browser.loadurl ( 'JavaScript : SomeFunction ()');

이것을 시도하고 테스트하십시오.

자바 스크립트는 결코 호출되지 않습니다. 그러나 내 터치 센서가 사용하려고 시도한 특정 기능으로서 괜찮습니다 (예 : 브라우저를 철자하는 경우 '잘못된 경우) 오류가 발생합니다.

아마도 이것은 현대 브라우저가 지원하지 않습니까?

도움과 조언은 크게 감사 할 것입니다.

    DEF alertScript Script {
    eventIn SFTime make_alert
    url [ "javascript:
    function make_alert (value) {
      Browser.loadURL('javascript:alert()');
    }
    " ]
}


ROUTE touchBack.touchTime TO alertScript.make_alert
.

도움이 되었습니까?

해결책

Do they only want classic VRML or is X3D allowed ? (X3D is the name of the current version of VRML).

If you are allowed to use X3D (I don't see why not), you could use X3DOM which is a WebGL engine, you may even get extra points on your assignment :)


Here's an example that hides a div when you click on a 3D sphere:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Touchsensor in X3DOM</title>

    <link href="x3dom.css" rel="stylesheet" />
    <style>
    #myDiv {
        color: blue;
        margin: 20px 0;
    }
    x3d {
        display: block;
        width: 600px;
        height: 400px;
        background: #EEEEEE;
        border: none;
    }
    </style>
</head>
<body>


    <div id="myDiv">
        Click the sphere to hide this div
    </div>

    <x3d>
        <Scene>
            <Shape id="mySphere">
                <Appearance>
                    <Material diffuseColor="0 1 0" />
                </Appearance>
                <Sphere/>
            </Shape>
        </Scene>
    </x3d>


    <script src="x3dom.js"></script>
    <script>
    (function() {

        document.getElementById('mySphere').onclick = function(){
            document.getElementById('myDiv').style.display = "none";
        };

    })();
    </script>


</body>
</html>

And by the way, X3D is the recommended 3D technology by the HTML5 spec, it isn't dead at all :-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top