Search the Community
Showing results for tags 'direction'.
-
How can I set the direction at which an object should be moving at in MatterJS physics? In Arcade physics I'd do `this.scene.physics.velocityFromRotation(angle, this.speed, this.velocity);`, but MatterJS doesn't seem to have a `velocityFromRotation` method.
-
Hi there, I want to implement a car which can be dragged and is able to turn around corners while being draged so far I only found a posibility to turn in direction of the pointer (eg mouse) but than the car turns before it is even (pixelperfect)clicked too any sugguesstions or helpfull links? thanks:)
-
Hi gang. I have another noob question. I have a direction vector (-1, 0, 0). Let's pretend that is "forward". (it could be a much more complex direction, too) If I want to "derive"/calc a LEFT and RIGHT direction... based-upon the first direction, what might be the best way? Or, ANY way. Essentially, I need v3.leftFromDirection(firstDirection) and v3.rightFromDirection(firstDirection) Would that be "left orthogonal" and "right orthogonal"? I think so. firstDirection.negate() returns the opposite direction, so that condition is handled. Can anyone help? Thx!
- 27 replies
-
- direction
- perpendicular
-
(and 1 more)
Tagged with:
-
Hi gang! I'm still having problems "aiming" mesh in some direction (vector). I know, I know, I should have this mastered and memorized, but, not yet. https://www.babylonjs-playground.com/#BFM7EX#24 I have TWO cones that need to be set per the direction of a spotlight. #1. The green cone (arrow1) needs its POINT aimed the same direction as the spotlight. (-1, -1, -1) #2. The curiously black-sided blue cone (spotcone) needs its WIDE-END... aimed in same direction as spotlight. I added the spotlight so I could "see" a -1, -1, -1 direction... and I know spotlights do direction correctly. I could "steal" example code from spotlight direction-setting code, but that direction-setting code... rotates no mesh. It only creates light directions, and lights aren't mesh. The spotlight is positioned where the two cones meet. And again, the spot is aimed -1, -1, -1, and it appears to be using that direction properly. Feel free to turn-off animation in lines 101-102. They are there only to prove that I have my pivot points set correctly for the two types of cones. There are two un-coded important functions. Lines 73-75 to set arrow1 aiming, and lines 80-82 to set spotcone aiming. Lines 95 and 96 are where both do-nothing functions are called-from. Can someone please assist me in coding arrow.setDirection(direction) [line 73] and spotcone.setDirection(direction) [line 80] ? That would be great. Currently, cam is aiming +z. We already knew that, because the -1, -1, -1 spotlight direction... is down, left, and backwards toward the cam. Thanks again for any/all assistance/consideration.
- 10 replies
-
- direction to rotation
- direction-to-rotation
-
(and 2 more)
Tagged with:
-
I try something pretty easy (I think) but I cant make it work. The want that the faces are aligned in their direction between two world space Vector3. The position on the screenshot is not correct but that's not the problem. I tried it with lookAt for the mesh and also played a bit around with RotationFromAxis from this example http://www.babylonjs-playground.com/#1QM99D#6 But its always not correct rotated, correct would it be when they are aligned along the edge between the two vertices where currently the feces are placed. Any suggestions?
-
Hello. Sorry in advance for my bad english language. I am new in babylon.js and I tried some things and i relly like it.Now I want to make RPG game when player will be move forward with "w" and will go to mouse pointer direction but I can´t to figure out. Always redBox (player) wierdly go in to opposite duraction and in a case of collision i don't have any idea how it works here si my project : http://www.babylonjs-playground.com/#3F5YVW#2 I will be so glad if you can show me way how to reach a results .
-
Hello. Sorry in advance for my bad english language. I am new in babylon.js and I tried some things and i relly like it.Now I want to make RPG game when player will be move forward with "w" and will go to mouse pointer direction but I can´t to figure out. Always redBox (player) wierdly go in to opposite duraction and in a case of collision i don't have any idea how it works here si my project : http://www.babylonjs-playground.com/#3F5YVW#2 I tried everything what i found on forum. I will be so glad if you can show me way how to reach a results .
-
I have this Code to move a player (3rd person) forward and backward, with the arrow keys left-right I can rotate the Player: if (key == 37) // left android.rotation.y -= Math.PI/2; if (key == 38) // foreward android.position.z += 0.5; if (key == 39) // right android.rotation.y += Math.PI/2; if (key == 40) // backward android.position.z -= 0.5; But after a rotation the facing direction is wrong. How can I correct this?
-
hy guys, i have problem with the mesh going in the specified direction, the bullet in this code goes along x axis :- BABYLON.SceneLoader.Load("Building/", "Building.babylon", engine, function (scene) { // Wait for textures and shaders to be ready scene.executeWhenReady(function () { //bullet var bullet = BABYLON.Mesh.CreateSphere('bullet', 3, 0.5, scene); var sphere2 = BABYLON.Mesh.CreateSphere("sphere1", 16, 0.5, scene); bullet.position = new BABYLON.Vector3(0, 0, 0);; bullet.parent = sphere; sphere2.position.y = 2; sphere.parent = scene.activeCamera; sphere.position = new BABYLON.Vector3(0, 0, 1); scene.registerBeforeRender(function () { bullet.position.z += 0.05; });
-
Hello, I saw a post about limiting camera zoom and direction. However, I want to limit camera to a "top-down" only view. Zoom in and out is acceptable. Probably leave that alone. But I want to restrict the ability to rotate the view. Is it doable? If so how? Thank you...
-
Hello everybody. I think I got myself into a trap. In our configurator, you start planning in 2D space. Where X is from left to right and Y from top to bottom. Then you can switch and see the 3D view of your planning. Now as I have forgotten or just suppressed it, is that babylon handles some directions differently. Now X is mirrored. I tried to but an invisible box as a parent and then set scaling.x to -1. Unfortunately then everything is illuminated wrong, therefore I tried to flip the normals too, but that didn't help neither. What would be the best way? Please keep in mind that there is no model that could be exported with another parameter for the left or right handed thing. Please look at the screenshot below for more clearity. Thanks!
-
I want to scope after clicking the mouse flew in the direction of movement of the camera, thus emulated shot. Possible example on three.js: http://pauluskp.com/cannot My attempt to do so at Babylon: http://www.babylonjs-playground.com/#VWXHP#1 Here is the basic code, then I created a sphere when clicked, and then later in scene.registerBeforeRenderthe set coordinates camera adding a constant but probably incorrectly specified coordinates. window.addEventListener("click", function (e) { var bullet = new BABYLON.Mesh.CreateSphere('bullet', 3, 0.3, scene); var pos = camera.position; bullet.position = new BABYLON.Vector3( pos.x, pos.y, pos.z); bullet.material = new BABYLON.StandardMaterial('texture1', scene); bullet.material.diffuseColor = new BABYLON.Color3(3, 2, 0); var alpha = 0; scene.registerBeforeRender(function () { bullet.position = new BABYLON.Vector3( alpha*pos.x, alpha*pos.y, alpha*pos.z ); alpha += 0.01; });
- 5 replies
-
- Babylon.js
- bullets
-
(and 1 more)
Tagged with:
-
Hi, I develop a game which uses P2 and collisions. But in the latest versions, the behavior of move, speed and collision are very different. My reference example is “World move” between Phaser 2.0.6 and the lastest version. http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=world+move.js&t=world%20move I think the move behavior is more realistic in Phaser 2.0.6. So, how to keep these behaviors with the last version? I have made live examples with jsbin, to see the differences : Test 1: moveforward 3000 + angle 90 The ball bounces many times, and the speed gradually slows Phaser 2.0.6: http://jsbin.com/moxijibebuta/1/edit?html,js,output The ball bounces one time and nothing… Phaser 2.1.2: http://jsbin.com/kipayexoqadu/8/edit?html,js,output Test 2: moveforward 1000 + angle 60 The ball bounce many times, and the direction is fine for each bounce. Phaser 2.0.6: http://jsbin.com/wiloyizanucu/1/edit?html,js,output Indescribable… Phaser 2.1.2: http://jsbin.com/rejidageguhu/1/edit?html,js,output What do you think about that? Can we have the movement from 2.0.6 with the latest version?
-
Hello everyone this is my first time on the forums and I'm a little weak when it comes to trigonometry and geometry. I'm trying to simply move the camera "forward" depending on the direction the camera is facing. Regardless of the solution requiring a library, I'd really like to learn the math behind it. Could anyone give me any help? Thank you for your answers.