When using three.js orbitControl, inputting text into textboxes in a Ruby on Rails application is

My three.js application seems to be causing issues with my text field in my Ruby on Rails application. I am unable to write anything in the text field or even click on it. Does anyone know why this is happening? Here is a snippet of my three.js application:

var box = document.getElementById('player');
if(box){
var boxSize = box.clientWidth;
}
var $player;
var clock = new THREE.Clock();

var camera, scene, renderer;
var mixer, skeletonHelper;

init();
animate();
loadBVH('<%= asset_path 'forehand.bvh' %>');

function init() {

camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.set( 0, 100, 400 );

controls = new THREE.OrbitControls( camera );
controls.enableZoom = false;

controls.minDistance = 300;
controls.maxDistance = 700;

scene = new THREE.Scene();

scene.add( new THREE.GridHelper( 200, 10 ) );
// renderer
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setClearColor( 0xeeeeee );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( boxSize, boxSize );

$player = $('#player');
$player.append(renderer.domElement);

}

function loadBVH(pathBVH) {
var loader = new THREE.BVHLoader();
loader.load(pathBVH, function( result ) {

    skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] );
    skeletonHelper.skeleton = result.skeleton;

    var boneContainer = new THREE.Group();
    boneContainer.add( result.skeleton.bones[ 0 ] );

    scene.add( skeletonHelper );
    scene.add( boneContainer );


    mixer = new THREE.AnimationMixer( skeletonHelper );
    mixer.clipAction( result.clip ).setEffectiveWeight( 1.0 ).play();

});
}

function animate(){

requestAnimationFrame( animate );

var delta = clock.getDelta();

if ( mixer ) mixer.update( delta );
if ( skeletonHelper ) skeletonHelper.update();

renderer.render( scene, camera );
}


function showMotion(role, mood, param, name, weight, gender, body_height, shoulder_width,
shoulder_height, inner_leg_length, tibia_length, body_depth, hip_width, seat_height,
shoulder_elbow_length, elbow_wrist_length, chest_girth, waist_girth, thigh_girth, path){

var fieldNameElement = document.getElementById("details");
fieldNameElement.innerHTML =
    '<h4 class="motion-font">' + 'Motion: '
    + '</h4>'
    + '<div class="motion-font">'
    + 'Role: ' + role + '<br/>'
    + 'Mood: ' +  mood + '<br/>'
    + 'Description: ' + param + '<br/>'
    + '</div>'
    + '<h4 class="motion-font">' + 'Actor: '
    + '</h4>'
    + '<div class="motion-font">'
    + 'name: ' +  name + '<br/>'
    + 'weight: ' +  weight + '<br/>'
    + 'gender: ' +  gender + '<br/>'
    + 'body height: ' +  body_height + '<br/>'
    + 'shoulder width: ' +  shoulder_width + '<br/>'
    + 'shoulder height: ' +  shoulder_height + '<br/>'
    + 'inner leg length: ' +  inner_leg_length + '<br/>'
    + 'tibia length: ' + tibia_length  + '<br/>'
    + 'body depth: ' + body_depth  + '<br/>'
    + 'hip width: ' +  hip_width + '<br/>'
    + 'seat height: ' + seat_height  + '<br/>'
    + 'shoulder elbow length: ' +  shoulder_elbow_length + '<br/>'
    + 'elbow wrist length: ' +  elbow_wrist_length + '<br/>'
    + 'chest girth: ' +  chest_girth + '<br/>'
    + 'waist girth: ' +  waist_girth + '<br/>'
    + 'thigh girth: ' + thigh_girth  + '<br/>'
    + '</div>';

scene.remove( skeletonHelper );
clock = new THREE.Clock();
loadBVH(path);

}

Upon further testing, I discovered that the line:

controls = new THREE.OrbitControls( camera );

is causing the issue. However, I am unsure of the specific reason behind this problem. Additionally, my text box code looks like this:

<%= select_tag :search_mood, options_from_collection_for_select(Motion.all.uniq{ |x| x.mood }, :mood, :mood, params[:search_mood]), include_blank:  true, class: 'js-example-placeholder-single mood' %>

Answer №1

The issue has been identified and resolved. The correct way to call the Three.OrbitControl is now clear to me:

controls = new THREE.OrbitControls( camera, renderer.domElement );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The passport authentication process is currently stalled and failing to provide any results

The current authentication process is functioning properly app.post('/login', passport.authenticate('local-login', { successRedirect: '/home', failureRedirect: '/login', failureFlash: true }) ); Howev ...

Scraping JavaScript Content Webpages with VBA

I'm attempting to extract a table from the Drainage Services Department website. I've written the VBA code below, but it doesn't seem to be working. I suspect that the issue lies in the fact that this particular table is generated using Java ...

Tips on harnessing the power of PhantomJS and node.js for web scraping

After successfully installing node-phantom using the command npm install node-phantom, I encountered an error when running this code: Cannot find module 'webpage' var webpage = require('webpage').create(), url = "https://www.exampl ...

"Make sure to specify Safari input field as an email and mark

I am experiencing an issue with a contact form in my HTML/PHP code. Everything seems to be working fine, but when using the SAFARI browser, the form fails to validate if I try to submit without filling out all input fields. For example, my form includes: ...

Searching for a point within a specified range using Sequelize

I have a model called Location with a field named coordinates of type geometry. I'm looking to create a function that takes in latitude, longitude, and radius as parameters, and returns all locations within that radius (in meters). I attempted to foll ...

Issue with Google Finance JSON response not functioning as expected in Chrome and Firefox browsers, yet appears to be working properly in

I am currently working on a JavaScript project that involves fetching STOCK data from the Google Finance API. When I manually paste the link into my browser, I can successfully retrieve the JSON response: // [ { "id": "22144" ,"t" : "AAPL" ,"e" : "NASDAQ ...

Executing a JQuery click event without triggering a page refresh

I'm dealing with a basic form on a webpage <div class="data-form"> <p>Are you hungry?</p> <form> <label class="radio-inline"><input type="radio" name="optradio" value="yes">Yes</label> ...

Retrieve a file through a POST request with node.js

Hi everyone, I'm trying to create a "export to excel" functionality in Node.js for a page. By using Chrome DevTools, I discovered that the file is downloaded after a post request, so I need to replicate it. https://i.sstatic.net/aL9SO.png var reques ...

How are the actions in react redux able to utilize dispatch and getState methods?

Could you please explain how the actions.js in the reddit example of the react redux docs is able to access the dispatch and getState functions without importing them explicitly? I was under the assumption that every method needed to be imported in each ...

jQuery-powered Ajax file upload progress bar

Although I don't rely on jQuery for everything, I do find it useful for tasks such as AJAX. But currently, I'm facing some challenges with it. Here is a piece of code that should update my upload progress bar while the upload process is ongoing. ...

Selenium2: Exploring ways to retrieve error specifics after executeScript() encounters a failure

While facing certain idiosyncrasies with browsers, I often have to execute JavaScript commands during testing. Every now and then, Selenium returns an error stating that there was a JavaScript error without providing any specifics. Is there a method to re ...

What are the steps to employ a query string to display a specific image?

If I understand correctly, I can utilize a query string and parse it to display certain information. How would I apply that concept to load a specific image? https://codepen.io/anon/pen/qYXexG <div id="gallery"> <div id="panel"> <img ...

Encountering an error in AngularJS: Issue with require(...) function, along with a runtime error in Node

I have been working on a code similar to the one available here However, when I try to run node web.js, I encounter a TypeError: require(...) is not a function What could be causing this error? Where might the issue lie? Below is my current web.js set ...

Can you provide me with the sequelize query that is equivalent to this raw query?

Retrieve the ID from the offers table where the user ID is not equal to '2' and the ID is not present in the list of notified offers for user '2'. ...

The first three AJAX requests are successful, but the fourth one fails to reach the PHP script

I am currently working on cascaded selects (a total of 4) that retrieve data from a database. To populate them, I use SQL queries based on the selection made in the previous select element. To establish communication between the select element and the subs ...

Adjust the hue of a specific node

Is there a way to customize the color of an individual node in an eChart treemap? I attempted to set a color property for the node, but it didn't seem to work. While I was able to change the label's color, I'm interested in changing the back ...

Ways to customize decoration in Material UI TextField

Struggling to adjust the default 14px padding-left applied by startAdornment in order to make the adornment occupy half of the TextField. Having trouble styling the startAdornment overall. Attempts to style the div itself have been partially successful, b ...

Disable the 'bouncy scrolling' feature for mobile devices

Is there a way to prevent the bouncy scrolling behavior on mobile devices? For example, when there is no content below to scroll, but you can still scroll up and then it bounces back when released. Here is my HTML structure: <html> <body> ...

Oops! The react-social-media-embed encountered a TypeError because it tried to extend a value that is either undefined, not a

I recently attempted to incorporate the "react-social-media-embed" package into my Next.js project using TypeScript. Here's what I did: npm i react-social-media-embed Here is a snippet from my page.tsx: import { InstagramEmbed } from 'react-soc ...

"Permission denied to access restricted URI" error encountered while attempting to utilize ng-template functionality

I am attempting to implement ng-include for recursive templates in my HTML. After testing it on jsfiddle and confirming that it works, I tried the same locally. However, I encountered the following error: Error: Access to restricted URI denied createHttpB ...