Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8329267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:43:23+00:00 2026-06-09T01:43:23+00:00

when i use this as code for a cube and a sphere which cuts

  • 0

when i use this as code for a cube and a sphere which cuts some part of this cube out:

    <!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="csg.js"></script>
<script type="text/javascript" src="http://chandler.prallfamily.com/threebuilds/builds/r46/ThreeMin.js"></script>
<script type="text/javascript" src="ThreeCSG.js"></script>

<script type="text/javascript">

window.onload = function() {

var projector = new THREE.Projector( );
var renderer = new THREE.WebGLRenderer({antialias: false});
renderer.setSize(800, 640);

document.getElementById('viewport').appendChild(renderer.domElement);

var scene = new THREE.Scene();

var camera = new THREE.PerspectiveCamera(
    35,
    800 / 640,
    1,
    10000
);
camera.position.set(5, 1.8, 5);
camera.lookAt(scene.position);

var cube = THREE.CSG.toCSG(
    new THREE.CubeGeometry( 2, 2, 2 ),
    new THREE.Vector3(-1, 0, 0)
);
var sphere = THREE.CSG.toCSG(new THREE.SphereGeometry(1.4, 16, 16));
var geometry = cube.subtract(sphere);
var mesh = new THREE.Mesh(
    THREE.CSG.fromCSG( geometry ),
    new THREE.MeshNormalMaterial()
);
scene.add( mesh );

renderer.render(scene, camera);

}

</script>

</head>

<body>

<div id="viewport"></div>

</body>

</html>

How can I now set the position of the cube? Do I need something like cube.CSG.position.set or is there a special method with the CSG library to use?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:43:27+00:00Added an answer on June 9, 2026 at 1:43 am

    You need to call a function after setting the renderer, like:

    animate();
    

    Define it like:

    function animate()
    {
        requestAnimationFrame(animate);
        cube.position.x = your_value;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code which is taken from MVC futures and attach the Attribute
I use this code in a Servlet which sets the file name of the
i use this code : request.session.set_test_cookie() the all code is : def main(request, template_name='index.html'):
I use this code the render the menu <% Html.Menu(GridSampleMenu.AdminMenu(Url)); %> but I don't
When I use this code, everything works fine: document.getElementById('cube').style.webkitTransform = rotateX(+xAngle+deg) rotateY(+yAngle+deg); But, when
I use this code : MethodInvoker TileLoadCompleteMethodInvoker = delegate() { CleanStatusLabelTimer.Enabled = true; MemoryTextBox.Text
i use this code in my app. just found is not correct when compare
I use this code to connect to SQL Server 2012, but it does not
I use this code to select password field from the sql server 2012 db,
I use this code , to log $_SERVER['REMOTE_ADDR']; to my small db my issue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.