lakhi Posted April 15, 2017 Share Posted April 15, 2017 Hi i am trying to use babylon.js in my pool project. issue is the pool game in on 3d webgl nd i m keeping the camera view in one static position. now i want to move the arc camera of babylon in that angle too Quote Link to comment Share on other sites More sharing options...
lakhi Posted April 15, 2017 Author Share Posted April 15, 2017 here is the screenshot Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 17, 2017 Share Posted April 17, 2017 Here is a code which set the camera up like you want: https://www.babylonjs-playground.com/#HT80JV Quote Link to comment Share on other sites More sharing options...
lakhi Posted April 17, 2017 Author Share Posted April 17, 2017 22 minutes ago, Deltakosh said: Here is a code which set the camera up like you want: https://www.babylonjs-playground.com/#HT80JV Hi not actually up but in my case i am trying to put the camera perpendicularly so that in the screenshot below the line points from cue ball to group of balls. I have tried your code but its still in same position. the codes that i wrote for the camera is this var camera = new BABYLON.ArcRotateCamera("camera1", Math.PI / 2, 0, 10,new BABYLON.Vector3(0, 0, 0), scene); camera.setPosition(new BABYLON.Vector3(0, 0, -100)); Quote Link to comment Share on other sites More sharing options...
brianzinn Posted April 17, 2017 Share Posted April 17, 2017 Have you tried the ArcFollowCamera http://doc.babylonjs.com/classes/2.5/arcfollowcamera ? Or is it that you want to limit the rotation of the user, which you can do with alpha/beta upper and lower limits. You can set the ArcRotateCamera target to any vector3 (http://doc.babylonjs.com/classes/2.5/arcrotatecamera). Not sure exactly what you are asking. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 17, 2017 Share Posted April 17, 2017 "Not sure exactly what you are asking." Me neither.. I struggle understanding your ask Quote Link to comment Share on other sites More sharing options...
lakhi Posted April 17, 2017 Author Share Posted April 17, 2017 ok let me try again the pool board that you see in the screenshot i got that from google and it was built in google o3d and basically its a 3d table. originally in x,y axis the view of the table on first load is portrait but to make it look good i have changed it to 2d like view and turned off the 3d movements. now i am trying to use babylon to create the line from cue but issue is its direction is x,y so i am just curious to find if the camera view can be rotated to 90 deg so that y axis become x and x axis become y. sorry if my question is wrong i am trying to learn this technology Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 18, 2017 Share Posted April 18, 2017 Ok I think I understand Why not rotating your table (with table.rotation.x / y / z) instead? Quote Link to comment Share on other sites More sharing options...
lakhi Posted April 19, 2017 Author Share Posted April 19, 2017 ok cool yes i was able to fix the issue but i have a new issue now. can you pls see the screenshot? https://www.diigo.com/item/image/5pfye/v1mb i am trying to make it so that the 2nd point from cue ball changes on mouse move. my mouse pointer is on the red dot but the second point is not on the red dot and line goes too far from the pointer. here is my full code this.angleCue = function(){ canvas = document.createElement('canvas'); canvas.width = g_client.width; canvas.height = g_client.height; canvas.setAttribute("id", "canvasID"); $('#o3d').append(canvas); engine = new BABYLON.Engine(canvas, true); scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color4( 0, 0, 0, 0.1); var camera = new BABYLON.ArcRotateCamera("camera1", 0, 0, 0,new BABYLON.Vector3(0, 0, 0), scene); camera.setPosition(new BABYLON.Vector3(0, 0, -100)); camera.attachControl(canvas, false); var pl = new BABYLON.PointLight("pl", new BABYLON.Vector3(0, 0, 0), scene); pl.diffuse = new BABYLON.Color3(1, 1, 1); pl.specular = new BABYLON.Color3(1, 0, 0); pl.intensity = 0.95; var path = []; var cue = g_physics.balls[0]; var cue2 = g_physics.balls[8]; path.push(new BABYLON.Vector3(cue.center[1],cue.center[0],0)); path.push(new BABYLON.Vector3(cue2.center[1],cue2.center[0],0)); mesh = BABYLON.Mesh.CreateLines("lines", path, scene, true); scene.render(); }; this.angleUpdate = function(x,y){ var cue = g_physics.balls[0]; var lastx = x-g_client.width/2; var lasty = y-g_client.height/2; var path = []; path.push(new BABYLON.Vector3(cue.center[1],cue.center[0],0)); path.push(new BABYLON.Vector3(lasty, lastx, 0)); mesh = BABYLON.Mesh.CreateLines(null, path, null, null, mesh); scene.render(); }; can you please check this for me? angleUpdate function runs on mouse move i know i am writing codes like a child sorry for disturbing you again and again Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 19, 2017 Share Posted April 19, 2017 Hello to be more helpful can you please create your repro on our Playground? Quote Link to comment Share on other sites More sharing options...
lakhi Posted April 20, 2017 Author Share Posted April 20, 2017 On 4/19/2017 at 9:13 PM, Deltakosh said: Hello to be more helpful can you please create your repro on our Playground? https://www.babylonjs-playground.com/#VGUTRM here i want to move the line with mouse pointer. now its not and goes far away from pointer Quote Link to comment Share on other sites More sharing options...
lakhi Posted April 22, 2017 Author Share Posted April 22, 2017 On 4/19/2017 at 9:13 PM, Deltakosh said: Hello to be more helpful can you please create your repro on our Playground? https://www.babylonjs-playground.com/#VGUTRM here i want to move the line with mouse pointer. now its not and goes far away from pointer Any solution to this sir? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.