Search the Community

Showing results for tags 'parent'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 57 results

  1. Greetings to everyone, I've been using BabylonJs and Blender for a while but a i can't use the parent relationship between a camera and another mesh. Here is the code: // Load the .babylon fileBABYLON.SceneLoader.Load("./", "parent2.babylon", engine, function(newScene) { scene = newScene; scene.executeWhenReady(function() { var myCam = scene.activeCamera; myCam.ellipsoid = new BABYLON.Vector3(1, 1.5, 1); myCam.checkCollisions = true; myCam.applyGravity = true; myCam.attachControl(canvas); scene.activeCamera = myCam; var ground = BABYLON.Mesh.CreatePlane("ground", 60.0, scene); var materialPlan = new BABYLON.StandardMaterial("texturePlane", scene); materialPlan.diffuseTexture = new BABYLON.Texture("baldosa.jpg", scene); materialPlan.diffuseTexture.uScale = 5.0; materialPlan.diffuseTexture.vScale = 5.0; materialPlan.backFaceCulling = false; ground.material = materialPlan; ground.position = new BABYLON.Vector3(0, 0, 0); ground.rotation = new BABYLON.Vector3(Math.PI / 2, 0, 0); ground.checkCollisions = true; scene.collisionsEnabled = true; scene.gravity = new BABYLON.Vector3(0, -9.81, 0);Here you can see an example: Here you can check all the files: I also try to use this, but it fails.
  2. Hi peoplez! This is more or less a follow-up to this Thread in the Pixi.js section of this board. And this is what I want: The Player in the back is my parent. It is an object that is derived from the Phaser.Sprite class. The number and the text are my children, grouped together in player.attachments. I want the number to be centered and the text to be at the bottom of the player. Now this is how I tried to achieve that: player = new Player(game, 'player', 'Christian', player_number, x, y); player_scale = Math.min(magic.config.gameScale.x, magic.config.gameScale.y); player.scale.x = player_scale; player.scale.y = player_scale; player.anchor.setTo(0.5, 0.5); font_size = 30; name = game.add.text( 0, player.height/2, // text should go to the bottom of player's body, {/*style*/}); name.anchor.setTo(0.5, 1); font_size = 50; number = game.add.text( 0, 0, // text should go to center of the player's body (see anchor) player.number, {/*style*/}); number.anchor.setTo(0.5, 0.25); player.attachments.add(name); player.attachments.add(number); game.magic.players.add(player) As long as the player_scale is 1, everything works fine. But when it changes, the positioning is screwed up. And I still don't really get how this happens^^. With a smaller scale, it might look like this: In the Pixi.js thread moszis wrote: and mrBRC wrote: I tried to change my code accordingly, but that didn't put the texts at the correct positions either... If you have any suggestions or ideas, I'd be soo happy to hear them! Thanks for reading, if you made it down here . I really appreciate it! cheers bLind
  3. Hey guys, I did a search of the forums as well as the Phaser/Pixi docs and came up short (let me know if it's answered anywhere else). I'm trying to create a mechanic whereby the player is able to pick up and drop sprites. I've been able to achieve pickups by using the group.add() function where the group parent is the player sprite, but when using .remove() to drop the sprite, the sprite just completely disappears. Its position, alpha, scale etc all look sensible and haven't been modified. What I have seen however is that the sprite parent name changes to being undefined, which seems unhealthy as when it spawns in the world its parent appears to be "__world". I also tried directly calling addChild() inherited from Pixi which is used in the Phaser groups, and the result was the same. It's easy to reproduce, my code is below. This is in .create() this.testGroup = this.testLight = game.add.sprite(300, 300, "buttonGradient");This is in .update() if (PLAYER_OBJECT.inputIsActive("y")) { this.testGroup.add(this.testLight); } if (PLAYER_OBJECT.inputIsActive("u")) { this.testGroup.remove(this.testLight); }Does anyone know if my setup is bad, or if there are other ways to achieve my desired effect? I had a look at the group remove example on the official examples page and the same thing happens there - I don't know if it's a bug or an intentional result of the system. Thanks in advance!
  4. Hello, I have a problem with parent/child transformation. I have two meshes. I'd like to apply a rotation to one mesh, then define this mesh as parent and the other as child. But the child is also rotate. I wish to know how to rotate the parent without moving the child before assigning the parent relation. Thanks
  5. Hi, I wanted to create draggable buttons with some bitmaptext on them. I ended up with this: // the buttonvar button =, y, "button", 0);button.input.enableDrag(false, false);// an intermediary group, just to be able to set the draggable 'button' as parentvar group = new Phaser.Group(, button);// the text that i want to stick to the buttonvar text = new Phaser.BitmapText(, 2, 2, "main-font", "text!!");group.add(text);Is there a more clever way to do this? For instance, the text has a 'parent' property that I can set directly, skipping the group. text.parent = button; I suppose that's from PIXI.GameObjectContainer. Presently, setting it as above works. Is there a safe way to use it, or some other way to use sprites/images/"gameobjectcontainers" as parents directly?
  6. Hi, I am creating a character using different sprite parts and parenting it to a single sprite. //Parent spritethis.torso = group.create(0,0,actorType + '_body');this.torso.anchor.setTo(0.5, 0);//Child Sprite this.frontFoot = game.add.sprite(0,0, actorType + '_foot_front');this.frontFoot.anchor.setTo(0.5, 0);this.torso.addChild(this.frontFoot);I tried to enable the Physics body part of the parent sprite, Phaser.Physics.ARCADE);The result is that all child sprites have been given a body and started to drop. I just want the parent to drop itself and all child will just follow its parents. Can anyone explain further what is happening here? Any link or topics that might have discussed this?
  7. When you link a mesh(child) to another mesh(parent) is there a way to get the child mesh's position? Because currently the position that is returned is just the initial position of the child mesh in relation to the parent mesh.