Jump to content

Search the Community

Showing results for tags 'lookAt'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 16 results

  1. Good day, Sir. First, I want to say Thanks to everyone, who spent time to read this, I will be glad and happy to hear any advices or notes about this issue. Here is a PG: https://www.babylonjs-playground.com/#AI1MQC#2 Please, hide the SetEnviroment(), getPointsArray() and cameraMoveAnimation() functions bodies to make code more readable, I specially out them from main code. As you can see, there is 2 important lines: 82 and 83. Each points from "points" array is a real data from real project, that is not random numbers. So, the camera should move from: point1 to point2, then point2 to point3, then point3 to point4, and so on. There is no problems in start points, it's moving smoothly, but at point7 to point8 (and some others) camera rotates around itself. (Playground setted by default to reproduce this). It look like... flipping possible. I am using pivot method to create camera, and I can not use ArcRotateCamera in real project, because in some points it's broken because of gimbal look, for example, at point8 as I remember, it will dispose, and then appear, ArcRotateCamera was first, what I tried. So, the question is: how to prevent camera flipping around itself? ===================== upd: I tested a little more, if I am using lookAt method without animation and just setting new quaternion, it reproduces the same problem, but I don't have any idea why it happens and why it's changing rotation angle. ======================= upd2: I made additional example, which shows problem from outside: https://www.babylonjs-playground.com/#X66D1S#1 As you can see, big red sphere doing strange movement but if you change animation arguments in lines 82 and 83 from points[7], points[8] to points[6], points[7], sphere will do exactly what I needed, so what is it? Why it happens? How can I prevent this?
  2. https://www.babylonjs-playground.com/#PP962K#13 I tried to make rotation from point1 to point2 to point3 in Oxy plane as you can see by coordinates, but after point2 the camera starts to choose a strange path out of Oxy. Why it happens?
  3. Hello, Here's a PG: http://www.babylonjs-playground.com/#A5R1J3 and here's what should happen: The problem is the large cylinder does not "lookAt" the smaller cylinder. The large cylinder is parented to an empty which in turn is parented to an animated mesh and I think that is where the problem is. Is this by design or am I being hard of thinking? Thank you,
  4. Hello, Can mesh.lookAt be hardcoded into a .babylon file? If so, how? I have a few meshes in blender that I would like to use the 'Track To' constraint but I see that these are not supported for meshes in the exporter, whereas they are for cameras. I am hoping I can tweak the Blender > Bablyon exporter. I appreciate I can do the same thing in the js script, but I'd rather have Blender and the exporter do it for me. Cheers,
  5. QUESTION: How to animate many things? GOAL: review ALL types of Animation Options available. Reduce various animations into Patterns or Templates or MINIMUMS. There are great docs on this... what follows are the practices of each. RESULT: Animation-Type-Templates Examples: - eyes to look at stuff - mesh.lookAt() - a generic low-poly arm to grab stuff: bone animation - scene.beginAnimation() import from blender. - a generic IK arm - constraints - a morphing eyebrow - morph targets (minimum). - interpolate - random attributes like color, or opacity - a motion path - Blender Animation Ranges like: idle, jump, attack, die, win ADDITIONS: - Bone Animations - Review from docs - mesh.spinTo(), moveTo(), scaleTo() - Dynamic Animation (powerful?) - BABYLON.Animation.createAndStartAnimation() There are a ton a great resources on all of these. Point is: They are all different Animation Types. Highlighting the tricky spots, referencing solutions, and... the great docs and playgrounds that already exist. UPDATE: a long list of successful blender animation export examples below.
  6. I know I can't stop gimbal lock but I'd like to avoid the circumstances where it occurs in my application i.e. when a lookAt() call returns a vector close to the zenith. Basically I'd like to clamp the rotational pitch from 0 to 85 degrees, rather than allowing it to ever reach 90 degrees. I see the lookAt method has an optional parameter for pitchCor (pitch correction) but that doesn't seem to do what I want. What I'm thinking at the moment is I need to test the lookAt result to see of it's >= 85 degrees pitch and if so then clamp the pitch back to 85 degrees (without altering yaw) before applying the rotation to my mesh, but I'm a bit lost how to achieve that or if there's a better way. EDIT Here's a PG http://www.babylonjs-playground.com/#NM5LIX Basically as the lookAt() approaches the zenith I want to clamp the pitch input (even though it's not accurate this way) in order to eliminate the unnaturally fast spin. I hope this makes sense.
  7. Hi Is there something about the Mesh.lookAt method that means it won’t work on imported models? I have a .babylon file exported from my Unity scene. I can select individual meshes using: var mesh=scene.getMeshByName(“someMeshName”) This works because the exporter maintains the Unity GameObject names. Yet, if I then try: box.lookAt(mesh.position); //box is a mesh created with Babylon The “box” object’s rotation never changes. If, however, i create a second box object and make it the target of the lookAt() call, the “box” object’s rotation does change. I’ve checked the position property of the mesh I’m selecting with getMeshByName() and it’s not null, so I feel like I’m missing something here. Any thoughts? Cheers!
  8. Is there a way to tell the back of a mesh.to.lookAt() something? For example, need object to lookAt target point in opposite direction. Any tips? Thx,
  9. mesh.lookAt I want to get x, y, z after rotation What should I do? Mesh.rotation.x gets null
  10. It looks like mesh.lookAt() doesn 't work correctly if either the mesh and/or it's target are parented; is this intended or not? https://www.babylonjs-playground.com/#FZEH1H comment line 27 out for correct behavior.
  11. Trying to do a lookat clamp on both axes, the attached image shows my problem. my goal is to set a mesh to look at some object only if both axes are fall within clamp range. I found similar thread, but only discuss on one axis only. Very appreciated if anyone could provide direction or solution on this problem, thanks~
  12. Hi, Is there a built in way to "lookAt" a point in 3D space, using only 2 coordinates( x and y ). I found a lookAt function from this forum, but that used 3 coordinates which screws up the camera and player orientation. Id like to keep my player's z rotation always at 0.
  13. Edit : problem solved, look below ______ lookAt works well on the view. But the parameter rotation doesn't change staying at 0,0,0. And I need it after to calculate the vector forward in local space of a mesh to moveWithCollision : var forwards = new BABYLON.Vector3(parseFloat(Math.sin(character.rotation.y)) / speedCharacter, gravity, parseFloat(Math.cos(character.rotation.y)) / speedCharacter); forwards.negate(); character.moveWithCollisions(forwards); In the playground, I don't know how to display text to debug and Jsfiddle doesn't work so I paste my code here : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style> #renderCanvas { width: 100%; height: 95%; min-height: 95%; } </style> </head> <body> <div id="info"> aaa </div> <canvas id="renderCanvas"></canvas> <script src="http://cdn.babylonjs.com/2-4/babylon.js"></script> <script> var info = document.getElementById('info'); var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 10, BABYLON.Vector3.Zero(), scene); camera.attachControl(canvas, false); var light = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(0, 100, 100), scene); var cube = BABYLON.Mesh.CreateBox("Box", 1, scene); var cube2 = BABYLON.Mesh.CreateBox("Box2", 1, scene); cube.position.x = -5; var material = new BABYLON.StandardMaterial("default", scene); material.emissiveColor = new BABYLON.Color3(0.3, 0.3, 0.5); cube.material = material; var material2 = new BABYLON.StandardMaterial("default2", scene); material2.emissiveColor = new BABYLON.Color3(0.5, 0.3, 0.3); cube2.material = material2; scene.beforeRender = function() { }; // Render loop var renderLoop = function () { cube.lookAt(cube2.position); cube2.position.z += 0.01; info.innerHTML = cube.rotation; // !!! display 0,0,0 everytime !!! scene.render(); }; // Launch render loop engine.runRenderLoop(renderLoop); </script> </body> </html> Thank you
  14. Hi, i notised this bug a while ago, but never got around to reporting it before now, As shown in the following PG, the mesh.lookAt appears to rotate the mesh and the mesh "looks" at the object, but it doesn't actually update the mesh.rotation. the lookAt target is a sphere aproximately 45* from starting point. PG controls: left mouse click: lookAt & move based on mesh.rotation.y. mouse wheel click: rotate 90* and move based on mesh.rotation.y. right mouse click: move based on starting mesh.rotation.y. http://www.babylonjs-playground.com/#BJZC6#3 The lookAt method also seems to lock the target on 0 rotation.y, any new changes are completely ignored / overwritten. Console.log's of before and after each action (right-click only log's one line). 1 left mouse click(LookAt) & 2 mouse wheel clicks(+90*): VM379:45 Box.rotation.y Before lookAt: 0 VM379:48 Box.rotation.y After lookAt: 0 VM379:50 Box.rotation.y Before 90* rotation: 0 VM379:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM379:50 Box.rotation.y Before 90* rotation: 0 VM379:53 Box.rotation.y After 90* rotation: 1.5707963267948966 1 mouse wheel click(+90*) & 1 left mouse click(lookAt) & another mouse wheel click. VM385:50 Box.rotation.y Before 90* rotation: 0 VM385:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM385:45 Box.rotation.y Before lookAt: 1.5707963267948966 VM385:48 Box.rotation.y After lookAt: 0 //reset to 0..? VM385:50 Box.rotation.y Before 90* rotation: 0 VM385:53 Box.rotation.y After 90* rotation: 1.5707963267948966 //This doesn't effect anything. 4 mouse wheel clicks(+90*): VM378:50 Box.rotation.y Before 90* rotation: 0 VM378:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM378:50 Box.rotation.y Before 90* rotation: 1.5707963267948966 VM378:53 Box.rotation.y After 90* rotation: 3.141592653589793 VM378:50 Box.rotation.y Before 90* rotation: 3.141592653589793 VM378:53 Box.rotation.y After 90* rotation: 4.71238898038469 VM378:50 Box.rotation.y Before 90* rotation: 4.71238898038469 VM378:53 Box.rotation.y After 90* rotation: 6.283185307179586 1 right-mouse click(no rotation altering) & 2 mouse wheel clicks(+90*) & 1 right-mouse click again: VM380:55 Right-click, No rotation altering: 0 VM380:50 Box.rotation.y Before 90* rotation: 0 VM380:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM380:50 Box.rotation.y Before 90* rotation: 1.5707963267948966 VM380:53 Box.rotation.y After 90* rotation: 3.141592653589793 VM380:55 Right-click, No rotation altering: 3.141592653589793
  15. Hi, I want a 'Plane' which always should look at Camera, iam using ArcRotateCamera; Note: The Idea is, i have a 3d Building and placed Escalator symols(Plane with escalator symbol as texture) on the floor, these escalator symbols always need to look at the camera. Thanks,
  16. Hey guys, I wanted to use the lookAt function and then get the rotation of the mesh. But it seems the rotation doesn't actually change when using lookAt. Why is that? And is there a way to get the new rotation somehow? http://www.babylonjs-playground.com/#1QM99D
×
×
  • Create New...