Jump to content

Search the Community

Showing results for tags 'Position'.

  • 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

  1. Vacancy: 3d browser game developer (BabylonJS, PlayCanvas or ThreeJS) with experience in multiplayer Collaboration: project-based, freelance / remote, part-time/full-time Compensation: $100 - $200 for a full day We are currently looking for a middle-level 3d game developer with good potential and experience making multiplayer games. ⠀ Main tasks: Working on 3d browser game projects with multiplayer support. Using existing developments as much as possible. We are open to any of these 3d game engines (BabylonJS, PlayCanvas, ThreeJS) Discussion of creative ideas, technical solutions and client edits in Discord and Telegram (English) Basic todo/progress management in Trello (no formalism) May be useful, but not required: Experience with React, webpack. Important notes: We really welcome soft-skills and pleasantness in communication! It is required to have an individual entrepreneur / self-employment, or the willingness to apply for them Please send examples of projects you have worked on and your code. I usually reply within 1 - 2 days. Thanks! Contacts: ildepadronhosna [at] gmail [dot] com
  2. Hola hola, So I am working on a 2D basketball game. I am using 2 small sprites (with circular physics bodies) on each side of the basket rim for collision detection with the ball. I parented the 2 sprites to the backboard so I could move them all together (as shown in the child sprite example). I turned on the debug draw for the physics bodies and found the 2 bodies were not in the same position as the sprites. //Load net sprite this.net = this.game.add.sprite(this.game.world.centerX, 200, 'net'); this.net.anchor.setTo(0.5); //Add hoop children markers this.leftMarker = this.net.addChild(this.game.make.sprite(-66, 60, 'marker')); this.leftMarker.anchor.setTo(0.5); this.rightMarker = this.net.addChild(this.game.make.sprite(66, 60, 'marker')); this.rightMarker.anchor.setTo(0.5); I parent them like so.. but my physics bodies don't act as if they are parented. They should be at the same position as the sprite, but instead they are (-66, 60) and (66, 60) from the top left corner (0, 0) instead of (-66, 60) and (66, 60) from the parents position (world center x, 200). You can see the attached image as an example. Is there something I am missing? Is this the way it's supposed to be? Can I somehow update the physics bodies to line up with the sprites easily?
  3. Hey all! I am both new to Babylon and these forums! I want to make a First Person Camera that moves in a direction based on its rotation (e.i. like a forward/backwards functionality with W/S). Only problem is I don't know how to do this without maybe physics engines enabled or making a bunch of really janky movements. I want something like Unity's Transform.forward. How do I achieve this?
  4. I'm reading some tutorials about pixi.js and I can't understand the result I got from toLocal. I expect the result to be 100,100 however I got 200,200. Console output: bunny1: 100 100 bunny2: 200 200 200 200 Code: // create our little bunny friend..S var bunny = new PIXI.Sprite(texture); bunny.interactive = true; bunny.buttonMode = true; bunny.anchor.set(0.5); bunny.scale.set(1); bunny.x = 100; bunny.y = 100; // create our little bunny friend..S var bunny2 = new PIXI.Sprite(texture); bunny2.interactive = true; bunny2.buttonMode = true; bunny2.anchor.set(0.5); bunny2.scale.set(1); bunny2.x = 200; bunny2.y = 200; // add it to the stage app.stage.addChild(bunny); app.stage.addChild(bunny2); console.log("bunny1:",bunny.x,bunny.y) console.log("bunny2:",bunny2.x,bunny2.y) console.log(bunny.toLocal(bunny.position, bunny2).x,bunny.toLocal(bunny.position, bunny2).y)
  5. Hi, I have 3 containers containing only square sprites as children of stage. Starting from the 3rd, every new container I add is offset by 8,8 visually but all of their properties say they aren't. To achieve the expected result I have to set the position of the 3rd Container to -8,-8 or else the black shape is offset. When I check getGlobalPosition of the container or the sprites in it they tell me they're not offset when they clearly are. (game.layers is just a POJO that contains references to the containers)
  6. Hello, I'm currently working on a CAD-ish program and we have chosen babylonjs as our 3D-engine. However, now we are about to implement some camera movements and we noticed that some of our meshes turns out to be really far away and therefore they have some really strange graphics artifacts. We are currently just drawing lines to visualize our models and we figured we wanted to translate the whole scene to the camera instead of moving the actual camera, basically always keep the mesh that we are looking at around origin. However, we are struggling with how the get the actual positions of the linesmeshes to be able to transform them. Here is a playground illustrating the problem: https://playground.babylonjs.com/#0Z00WR As noticed in the console all meshes drawn are located at 0,0,0. We are probably doing something wrong or have misunderstood something. Is there anyone who can help? Regards, Robert
  7. I have a problem with relocating a sprite in the game. In practice dragging an object, if this collides with another, I'd like it to position it with certain coordinates. I use Box2D physic. When sprite collides with another I set its coordinates in this way: sprite.body.x = 100; sprite.body.y = 100; but when I reclick on the object this, in a first moment, appears with coordinates 100,100 and then returns to the coordinates at the time of the collision. Can anybody help me? I've been struggling with this problem for several days and I can not find a solution! Thanks in advance, Vittorio
  8. What is the BEST way to move a camera by position... When using one of the built-in cameras ... you get good smooth movement... If I try to manually move the camera around using camera.position I don't get the desired effect. I can move the camera around using code like this (delta movements from input): public updateCameraPosition(camera: BABYLON.FreeCamera, horizontal: number, vertical: number, speed: number): void { if (camera != null) { var local = camera._computeLocalCameraSpeed() * speed; var cameraTransform:BABYLON.Matrix = BABYLON.Matrix.RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, 0); var deltaTransform:BABYLON.Vector3 = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(horizontal * local, 0, vertical * local), cameraTransform); camera.cameraDirection = camera.cameraDirection.add(deltaTransform); } } but when I just try set camera position... its funny (I know that vague)... But it would hard to show with all the "Test Project Code" I am using to learn how to move a camera around "Unity-Style" Just wondering of simply setting camera.position (on a universal camera) should give me free range movement like a unity camera.
  9. Given a vector expressed in global space and a mesh, how can I get the position of this vector within a mesh local space? Or, alternatively, how can I get a parent position within a child local space? Update: Just figured it out... It is simply vector.subtract(Mesh.getAbsolutePosition()), right? Update2: Ok it's not... Because it doesn't take in account the mesh rotation.
  10. hi all, I have a problem about the p2 body and sprite positon when I enable a p2 body to a sprite, I use fish.body.setRectangle(fish.width, fish.height); to set the body shape, but the position of body is far away from the sprite, anyone know what is the problem? thx
  11. Hello there. ? I have a sprite which rotates. And i have a healthbar added to that sprite as a child. My problem is: The healthbar does what children are supposed to do! But i don't want that! ? How to keep child sprites from rotating with their parent? I want it to always stay at the same position relative to the parents anchor. I'm not talking about fixing its angle - that can be done by simply setting it to the negative angle of its parent each time it rotates (at least i don't know any other way). I'm talking about its position. Is there a fixedToCamera equivalent for sprites? If not, some math would be cool, too. EDIT: I guess this could work with groups. But is there another way?
  12. Hello evryone Sorry in advance for my bad english; I wanna ask somthing about .ArcRotateCamera (); I want to make camera with locked position behind the player when the player moving but if player stand on the place he can moving around with the camera and when he again start moving the camera smoothly rotating to the locked position. I wondered if I will make somehow the camera will checking position.z of the player then camera will be calculate position behind the player. Here is my player how move in game for better understending: http://www.babylonjs-playground.com/#TGA1QA By the way I only want some tips or show me a way how I can make this work out I want to fully understand how javascript and babylon.js works. Thank you.
  13. Hello, I have several meshes on paths, and need to begin particle animations at specific locations on the paths. However, when I use the position of an object or child on the path to start the particle animation, the condition is never met. I assume that the transforms are not updated on path animations. If I start the particle animation, it starts. But if I place it in a condition, in the same location in my script, the particle animation will not start. I'm using it on the same path which @JohnK helped me with last night:: if (mesh.position.y > 0) { smokeSystem.start(); } and mesh is on the path passing above 0.0 - which I've tried every axis and the particle system will not start. If I use collisions by placing a cube on the path which my object must pass through such as: let abc = BABYLON.MeshBuilder.CreateBox(`abc`, { size: 5 }, scene); abc.position = new BABYLON.Vector3(-50, 10, 100); if (vehicle.intersectsMesh(abc, true)) { smokeSystem.start(); } The particles will not start. But if I say smokeSystem.start(); in the exact same location, the particles start. I've spent hours on this, and tried everything I know. If anyone can help, please let me know as I have to finish this tomorrow. Thanks much, DB
  14. Is it possible to get the absolute rotation of a child mesh, in the same way it is possible to get the absolute position of a child mesh via mesh.getAbsolutePosition?
  15. Hi I have a newbie question that I feel silly asking but I couldn't find an example that demonstrated this yet. I have set the size of the canvas using the following code: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'new-phaser-game', { preload: preload, create: create, update: update, render: render }); I have added a sprite that sits at the bottom of the screen full width (as expected) using the following: shapeMenu = game.add.sprite(0, 500, 'shapeMenu'); Now I would like to resize the world so that it sits inside this area with a margin around it (but inside the canvas). I have done this, but the world is sitting in the top left corner: game.world.setBounds(0, 0, 400, 400); Could any one advise on how I move this to the center of the screen (without moving the shapeMenu sprite as well)? Thanks!
  16. Hello, I have some UI elements on the DOM that I want to move relative to the 3D objects, I searched this forum and generally and the best I could find was: scene.afterRender = function() { var worldMatrix = planet2.getWorldMatrix(); var transformMatrix = scene.getTransformMatrix(true); var position = planet2.position; var viewport = scene.activeCamera.viewport; var coordinates = BABYLON.Vector3.Project(position, worldMatrix, transformMatrix, viewport); console.log(coordinates, window.innerWidth * coordinates.x); }; but unfortunately the coordinates keep changing because the object is rotating, so is there another way to track the object absolute position and convert that to screen position so I can use it the the `window` gets resized or when the camera changes angle?
  17. Hello, Is there a way to get the size of an object after the window has been resized? (Whole scene gets scaled down/up). planet2.getBoundingInfo().boundingBox.vectorsWorld; but it only displays 1.25 no matter how much I resize my browser window
  18. Hi, In the drag and drop demo in the playground, if I change position.addInPlace to absolutePosition.addInPlace it stops working. Can anyone explain what is happening here (thus also clarifying the difference between position and absolute position). Thanks!
  19. I have an array of items (stored as strings) I am displaying on screen as sprites, in an inventory. I want to update my array when an item is removed from my inventory, so I want to write a function that resets the x position of the objects. I can log out the right object and the right index value, but I can't seem to set the position of the object using this function. Any ideas ? example: inventory('key', 'rock', 'sword', 'note'); resetSlots: function() { //for every item in inventory, slot position is index number. inventory.forEach(function(item, index){ item.x = index * 150; console.log(item.x); //this returns "undefined" }) },
  20. Hi, I noticed that when I load a mesh at a certain position, the bottom center of the mesh will be at that position. For example, If I create a ground and then load a mesh at (0,0,0) then the mesh will be on the ground. So the actual center of the mesh is above the ground. How can I change the center of the mesh so that, for example, its actual center appears at (0,0,0)? Is there some sort of offset I can add? I hope the question makes sense. Thanks!
  21. Hi, Is there a way to render a part of 2D image on the screen with fixed position? Like in CSS we have position: fixed, position.left and position.top. I would like still to be able to use babylon.js options vOffset, uScale and wAng, like for textures, to move a visible part of the image. I could use a Plane with a texture, but I don't see an option to disable texture's repetition. Also I don't see a way to place it where I need on the screen with needed width/height. And still.. I need to disable lighting for it, set emissiveTexture, etc. So maybe there is a cleaner way to do this?
  22. Hi I'm still pretty new to phaser, and I've looked through the docs and a few examples, but still haven't found a solution to my problem. So, i have a sprite that is rotating around a set anchor, and I want to get the x and y coordinates of a specific point on this sprite. I could just do it with trigonometry and whatever, but I'm thinking that there has to be an easier way using phaser. Thanks in advance.
  23. Hey everyone hopefully this is worded ok and you are having a good day. I currently have a playable character which can be moved around and collide with objects. The issue i am having is once it has collided with a certain object i want the players character sprite to increase in size however when i do this using sprite.scale.setTo for some reason the position of the player sprite moves to 0,0. Apologise if that was not enough information i can provide more if needed.
  24. Hey everyone hopefully this is worded ok and you are having a good day. I currently have a playable character which can be moved around and collide with objects. The issue i am having is once it has collided with a certain object i want the players character sprite to increase in size however when i do this using sprite.scale.setTo for some reason the position of the player sprite moves to 0,0. Apologise if that was not enough information i can provide more if needed.
  25. Hi, I'm a new user and I do not know the rules of this forum. However, let you understand, I first define the context. I'm developing a peer-to-peer game, using the "simple-peer" API, all based on the opponent's position (x, y). My only issue concerns updating the remote sprite video so that I can update it using only using the moveToXY () function and if the tween do not work. Positions are captured with the peer's "data" listener, saving them to an array position: peer.on ('data', function (data) { positions = data.split("-"); console.log (positions[0] + "-" + positions[1]); } In the update function I would instead use this feature: this.tween = this.add.tween (opp) .to ({x: positions[0], y: positions[1]}, 1,Phaser.Easing.Linear.None, true); but unfortunately it does not work. I tried to test the tween replacing positions at player.x and player.y, but it works. How can I do? I am desperate.
×
×
  • Create New...