Jump to content

Search the Community

Showing results for tags 'parent'.

  • 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. 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?
  2. Hello, I am making a top down zombie shooter in Phaser 3. I am using the moveToObject function to make zombies follow the player. Now I want to make healthbars for the zombies. I have read that you can use containers to make the enemies and healthbars move together but I am having trouble to move the container with moveToObject. Is it possible to move a container with the moveToObject function or should I use something else instead?
  3. Whether Camera is the parent of a Mesh (in example below), or the other way around (in my personal project), when moving "fast" at speed = 1000, eventually there is some (discrepancy) jitter visible on the mesh - although it's probably the camera that isn't set correctly (some matrix?) http://www.babylonjs-playground.com/#P1YTR#1 Just click, rotate some, then hold Up and Left arrows and wait til the jitters come, at a few seconds in. Just an example of keys used. Even after stopping, if you try to move a bit or look-around, the jitter is already there. A painful bug for my space sim, where I need to move sonic faaaaast!
  4. Hi, trying to achieve mesh scaling from parent but with maintained aspect ratio, so if parent is scaled, child mesh will scale together but will maintain aspect ratio. would it be possible to do that by overriding `computeWorldMatrix` or there is better way to override default scaling behaviour ? I tried to override `_afterComputeWorldMatrix` to update world and local matrix, but no luck , probably doing something totally wrong protected _afterComputeWorldMatrix() { super._afterComputeWorldMatrix(); const min = Math.min(this._worldMatrix.m[0], this._worldMatrix.m[10]); this._worldMatrix.m[0] = min; this._worldMatrix.m[10] = min; this._localWorld.m[0] = min; this._localWorld.m[10] = min; } thanks for any hint
  5. 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,
  6. I have a sprite using (arcade) physics and I'm setting velocity to move around. When the player overlaps with a weapon, you can press a key to pick it up. I want the gun to be at an offset-ed position to the player and follow it around.. I thought parenting it was the easiest, but I can't figure out how to do it. Can anyone help me with this? ?
  7. Hello, Say I have ParentName > ChildName1 > ChildName2 > ChildName3, is there a quick way to have Babylon tell me the name of the ultimate parent, no matter which child I choose? I can get immediate parent using... scene.meshes[i].parent ... but I need to go right to the top. Cheers,
  8. Hi I'm trying to create a scene where randomly generated balloons move across the screen with toys hanging from them. When the user clicks the balloon the toy will drop and either hit or miss a basket. I would like to use a tween on the y position of each balloon so that they move up and down as well. I would like to use a tween on the toy so that it swings a bit (less important). I am thinking of setting up an array to push the balloon objects into so that I can push and pop as they are generated and destroyed. What is the best way to set up the parent > child relationship for the balloon and toys though please? Should I create a Phaser.GameObjects.Group() and create() the balloon and toy within that group and then push that group into my array? Or should I create each balloon and toy as a Phaser.GameObjects.Sprite and set a parent > child relationship somehow (I think you could use addChild() in Phaser 2?)? Or should I be using physics bodies and linking the toy to the balloon somehow, and then releasing that link to drop the toy when the balloon is clicked? Thanks! By the way, I don't know if it's helpful, but there is an error in http://labs.phaser.io/view.html?src=src\physics\arcade\circular body.js - "Uncaught ReferenceError: GetOverlapX is not defined".
  9. Howdy, Is it possible to create a group that contains a few meshes and then create instances of that group which includes the child meshes? How might one go about doing so? Thus far my attempts to create an instance of the group on creates the transform node but no children. Thanks! JPS
  10. 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?
  11. Hi, I've been using sprites but they don't seem to following the normal rules of being based off the parent objects position? I've made a quick example here to illustrate: http://www.babylonjs-playground.com/#KFFKV#7 Essentially the case seems to be: • A sprite can have another sprite as it's parent, but won't incorporate the parent's position • A sprite can have a mesh as it's parent, but won't incorporate the parent's position • A mesh cannot have a sprite as a parent • A mesh can have a mesh as a parent, and the child correctly follows the parent Is this correct? I was under the impression all objects with position should follow the parent:child positioning?
  12. Hi All, the issue I'm facing is probably trivial to solve but I couldn't find a solution. Basically I need to set the parent of a mesh (used as rotation pivot) to null after a rotation, because I need to use that pivot again for another group of meshes. I tried to use the following approach: var pos = box.getAbsolutePosition(); var rot = box.rotation; box.parent = null; box.setAbsolutePosition(pos); box.rotation = rot; but it seem to keep only the position, but not the rotation. I have created a simple playground to reproduce the problem : https://www.babylonjs-playground.com/#S13YXG#2 As you can see, when the animation is completed the bigger box returns to the original rotation. Any suggestion ? Thanks a lot in advance
  13. I am using the last official release 2.6.2. Given the following code, which can be found on the following jsbin: http://jsbin.com/lazefep/1/edit?js,output var MainState={ create: function(){ var circleGraphic = new Phaser.Graphics(); circleGraphic.beginFill(0xFFBBBB); circleGraphic.drawCircle(0, 0, 100); circleGraphic.endFill(); circleSprite = this.game.add.sprite(0, 0, circleGraphic.generateTexture()); //circleSprite.anchor.setTo(0.5); // (Try barSprite anchor below first.) Ugh, this doesn't fix it... var barGraphic = new Phaser.Graphics(); barGraphic.beginFill(0x88FF88); barGraphic.lineTo(250, 0); barGraphic.lineTo(250, 10); barGraphic.lineTo(0, 10); barGraphic.lineTo(0, 0); barGraphic.endFill(); var barSprite = this.game.add.sprite(this.game.world.width/2, this.game.world.height/2, barGraphic.generateTexture()); barSprite.addChild(circleSprite); //barSprite.anchor.setTo(0.5); // Why doesn't the child adjust to the anchor with the parent? } }; var game = new Phaser.Game(640, 480, Phaser.CANVAS, 'phaser-example', MainState); As long as the two lines remain commented out, what is rendered makes perfect sense: 1. A circleSprite is created and registered to position 0,0 of the parent sprite that it is later attached to. 2. A barSprite is created and its top left is added to the center of the world. 3. The circleSprite is added as a child to barSprite, and consequently, the top left of that child sprite is found at 0,0 of the parent sprite. As a result, you can see a sort of sideways "b" graphically depicted. Now, my (reasonable?) assumption is that the parent barSprite can be treated like any ordinary sprite as a composite whole. Anything I do to the parent sprite should automatically cause cascaded adjustments to the children so that the parent sprite would behave as it would if it were just an individual sprite on its own without any children behavior artifacts. However, if you notice, uncomment the line that sets the barSprite anchor, and the child does not follow. The child remains in place as if the anchor to the parent is not applied. To make matters worse, I have no easy recourse. I cannot recover the intended sideways "b" by uncommenting the circleSprite anchor. Is this a bug with anchor? Or is this intended behavior for some reason? What are my best options? (I am also curious if this behavior will exist in v3.) Also, please make me aware if you happen to see a violation of good/best practices!
  14. Hello It is possible turn off parent rotation ? var box = BABYLON.MeshBuilder.CreateBox("box1", 1, scene); var sphere = BABYLON.MeshBuilder.CreateSphere("sphere1", 1, scene); box.parent = sphere;
  15. Hi All, I have issue with clone mesh and cloned mesh attach to parent. After attached to parent cloned mesh position behaving strangely. http://www.babylonjs-playground.com/#HWQ2QH Line 22-23-24 //behaving strangely I've been scratching my head for a while, any suggestion?
  16. Hi guys! Jus wanted to update regarding a new feature that was pushed today. Until today any mesh with a parent couldn't have its own physics impostor and was considered to be a part of a compound along with the parent. This behavior can now be controlled using a new flag in the impostor options (part of the constructor. The behavior can be best seen in this simple playground: https://playground.babylonjs.com/#PRHF00 . The right sphere is a simple mesh and has no impostor. the left sphere has its parent set to the right sphere, and the impostor is set with the ignoreParent flag. The right sphere's position is still updated when the parent mesh is moving, but it is also being controlled by the physics engine. Fun times!! Another flag that I added has the amazing long name disableBidirectionalTransformation (a boolean). This flag will disable the bidirection transofmration between the physics engine and babylon, meaning - changing the mesh's position in babylon will practically do nothing. The object will be controlled solely by the impostor. This is done to add a performance boost, as the transformation step is being skipped. I am here for any questions! The playground is not fully updated, so this feature will be there pretty soon. Until then you can think what you can do with it
  17. So.... to my great disappointment - yes, another one of those - it looks like parented meshes don't work with physics engine. Is there any workaround? I think it's impossible for me to unroll all parenting in the project, it would break animations and god knows what else... BTW it looks like @Wingnut is currently working on similar issues (poor physics support). thumbs up to you for all the great work
  18. Hey Guys, I have an object parented to a modified ArcRotateCamera. The Camera can pan left and right. I want my object to move left and right with the camera but not rotate when the camera rotates around its target. Is there any way to freeze the rotations of a mesh so that it does not rotate with its parent?
  19. I'm fairly new to pixi.js and programming altogether. I am making a plugin that parses the xml save file of a sprite animation program and recreates the result in a game engine. The animation program uses bones for skeletal animations and the images (sprite parts) inherit the x, y, angle, scale_x, scale_y of the parent bone. The main idea would be to create sprites for the bones and the images, set up the bone inheritance to make the skeleton animation work correctly and then addChild the image sprites to the respective bone sprites. The only problem is that along with the aforementioned values, my image sprites also inherit the z_index of their container. The spriter does not limit the z hierarchy of the images to that of the parent bones, meaning that the user can change their z. I attempted to use worldTransform and worldAlpha for the parent bone values (keeping all the image sprites in a single container, thus controlling the z_index), but I am unable to get the parent bone's rotation. So, I either need to get all the values of the container and apply them correctly on the image sprites, or keep the image sprites inside the container and find a way to change their world z. Any suggestions would be appreciated and I thank you for your time.
  20. Hello there, What an amazing engine to render on webGL/Canvas! We are getting such a boost on performance thanks to this great library. Now, let's go to the point: We managed to partly migrate all our SVG animations to canvas using PixiJS. In order to do that, we had to parse our SVG so we could have a Container/Sprite/Textures structure that Pixi could manage and understand. We finally did it, and we have an Object like the onw you can see on the attached image: It is coming from the SVG you can find here: http://lab.pre.rtve.es/el-cuento/app/public/static/image/otto.svg So, what we have, is a lot of containers (what used to be groups in our SVG) and inside them, more Containers and finally Sprites containing Textures (what used to be paths). THE PROBLEM: We want to use Pixi's AnimatedSprite class so we can animate the mouth of our character, and when we do it, it works, but we lose the position of our Textures and they show at the upper left corner of our character. I can't see any position on this Sprites and Textures, so I guess they are just drawed where they are supposed to be and therefore when we try to animate them, we lose this relativeness to the parent and position. Any way to make them stay in place? Thank you very very much
  21. hi all, i'm trying to calculate the boundingbox of a parent mesh, so that i may get a good camera asprect. but failed to get the boundingbox size of the parent. are there any tricks there? pg http://www.babylonjs-playground.com/#QVIDL9 // Our built-in 'sphere' shape. Params: name, subdivs, size, scene var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene); // Move the sphere upward 1/2 its height sphere.position.y = 1; // Our built-in 'ground' shape. Params: name, width, depth, subdivs, scene var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene); var parent = new BABYLON.Mesh("parent",scene); sphere.parent = parent; ground.parent=parent; parent.showBoundingBox =true;
  22. Hi, have a problem with parenting physics objects together. Here an easy playground: http://www.babylonjs-playground.com/#AF886#1 Why is b dont collide with the ground too like the parent? I want both collide the ground and behave like one. Is it a bug?
  23. Hello guys, I have a little problem in my scenario. I am able to set the parent child relation among two meshes and i am able to move them along only if the parent mesh is dragged but not counter-wise. Both objects need to be able to be dragged and moved along together no matter which object is dragged. So i will be very thankful if anybody could help me. Thanks!
  24. gamify

    updatemoment()

    this.updateMovement( ); and this.parent( ); is not supporting in melonjs melonJS Game Engine v4.1.0 can anyone help for this
  25. Hello! I am working on a voxel project and creating a very basic voxel player. It has a box as head, a bigger box for body, etc. I created the whole thing like this: this.player_head = BABYLON.MeshBuilder.CreateBox(PLAYER_HEAD, {size: 1, updatable: true}, scene); this.player_body = BABYLON.MeshBuilder.CreateBox(PLAYER_BODY, {width: 1, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_right_arm = BABYLON.MeshBuilder.CreateBox(PLAYER_RIGHT_ARM, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_left_arm = BABYLON.MeshBuilder.CreateBox(PLAYER_LEFT_ARM, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_right_leg = BABYLON.MeshBuilder.CreateBox(PLAYER_RIGHT_LEG, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_left_leg = BABYLON.MeshBuilder.CreateBox(PLAYER_LEFT_LEG, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); // Head this.player_head.parent = this.player_body; this.player_head.position.y += 1.25; // Right arm this.player_right_arm.parent = this.player_body; this.player_right_arm.position.x += 0.75; // Left arm this.player_left_arm.parent = this.player_body; this.player_left_arm.position.x -= 0.75; // Right leg this.player_right_leg.parent = this.player_body; this.player_right_leg.position.x -= 0.25; this.player_right_leg.position.y -= 1.5; // Left leg this.player_left_leg.parent = this.player_body; this.player_left_leg.position.x += 0.25; this.player_left_leg.position.y -= 1.5; Since I need all the meshes to be treated as a single mesh, I merged them with: BABYLON.Mesh.MergeMeshes([this.player_head, this.player_body, this.player_right_arm, this.player_left_arm, this.player_left_leg, this.player_right_leg]); Until here, all beautiful and nice. But a problem arises: I want to be able to move the arms, legs and head to make some sort of animation for walking but it doesn't seem to work. My player object has the references to all the meshes before the merging, so I thought I would still be able to transform them even after the merging. What's wrong then? Also, is there perchance a better way to create a bunch of simple meshes, apply a specific material to each of them and then 'merging' them into 1 bigger BABYLON.Mesh without losing their individual texture/material? MergeMeshes destroys the materials of the children objects, which is quite bad :/.
×
×
  • Create New...