Jump to content

Move Mesh with Camera


zincman320
 Share

Recommended Posts

I have this camera:

var camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", Math.PI / 2, Math.PI / 3, 410, new BABYLON.Vector3(0, 0, 0), scene);camera.lowerRadiusLimit = 70;camera.upperRadiusLimit = 500;

And I have this mesh:

var testing = BABYLON.Mesh.CreatePlane("testing", 100, scene);testing.rotation = new BABYLON.Vector3(Math.PI / 2, Math.PI, 0);testing.position.y = -20;testing.parent = camera;

And I want the mesh to move with the camera when I call the following code:

$('#topBorder').on('mouseenter', function() {    this.iid = setInterval(function() {    scene.activeCamera.target.z -= speed;    }, interval);}).on('mouseleave', function(){    this.iid && clearInterval(this.iid);});

I thought the mesh would move since I set its parent to camera but it stays in the same place. Any suggestions?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...