Jump to content

Search the Community

Showing results for tags 'getbounds'.

  • 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 7 results

  1. Howdy, In my game I lock the cursor to canvas, so I use a pointer lock and then track/draw a "virtual cursor" manually. However, this causes sprite click callbacks to no longer trigger: sprite.inputEnabled = true; sprite.events.onInputUp.add(this.OnSpriteClick, this); Is there any way to get it working ? As a workaround, I figured I can manually check but I am having a hard time since figuring it out. sprite.getBounds() returns local bounds - how do I translate the my cursor position to sprite's local space? I couldn't find a matrix member under Sprite definition in the docs... Any
  2. Hi, I'm running into an issue regarding collision detection against adjacent DisplayObjects. Let's say I have sibling objects that are a child of a Container that has been rotated. If I use getBounds() on the siblings they return a bounding box that is oriented to cardinal north. Using those bounds for collision detection may result in false positives, because the given bounds may not follow the actual shape and orientation of the DisplayObject. I created a codepen to illustrate the point: When you toggle the "rotate" buttons at the bottom of the pen you will see the purple box morphing to the shape of the bounds for "shape" and "label". The text will change from red to green if the collision detection returns positive. I would like to do a more robust collision detection algorithm (possibly based on Separating Axis Theorem), but I would need to grab the vertices for each shape correctly translated to the global coordinates regardless of their nesting within the scene graph (accounting for scale, rotation, and translation from the shape and all parent transforms). The case being that the collision detection that I would like to do may not be only between direct siblings within the scene graph. Is there a nested property that would give me what I'm looking for, or will I need to grab the graphics data and apply all of the recursive parent transforms myself for each vertex? Here is a fork of a codepen that demonstrates the Separating Axis Theorem:
  3. To start, lets create a Graphics object. const clip = new PIXI.Graphics(); clip.clear(); clip.beginFill(0xAAAAAB, 0.3); clip.lineStyle(0); clip.drawRect(0, 0, 80, 60); clip.endFill(); There are getBounds() method and getLocalBounds() method in the PIXI.Graphics class. I guess one of these two methods are used to get a Rectangle bounds from the Graphics object. But which one? Is it getLocalBounds()? I find this one to be the nearest answer. So now we can use the `contains` method of PIXI.Rectangle to test if a point is in that rectangle. What if my rectangle rotates to a certain angle? like: clip.rotation = randomFloat(-Math.PI, Math.PI); randomFloat(min, max) { return min + Math.random() * (max - min); } Does my rectangle's getLocalBounds returns the correct bounds that rotates a angle? Say I want to build something like a radar that can scan dots around it. I use a very long rectangle and its pivot point is in one end and the other end just spin around the pivot point. Does the rotating rectangle's clip.getLocalBounds().contains(x, y) detect the scanned dots as it rotates? One step further, if my Graphics object also moves with a camera, which means the pivot point and the starting (x,y) of the rectangle changes all the time, I can still use this method right?
  4. https://jsfiddle.net/mvyu5b8j/ Check console. Wrong bounds Same with 4v seems work fine -> https://jsfiddle.net/atrvo643/ I can't migrate now, so maybe someone (life saver :)) can recommend a patch?
  5. Any chance to battle those small precision errors? https://jsfiddle.net/u0zgL0va/ (check console -> x:200.39999389648438)
  6. I'm using Phaser 2.3.0 and I want to know the bounds of a rotated sprite. But when I change sprite.rotation, the values of sprite.getBounds() don't change: var sprite = game.add.sprite(0, 0, "sprite"); // game.load.spritesheet("sprite", "spritesheet.png", 32, 32);console.log(sprite.getBounds()); // Object { x: 0, y: 0, width: 32, height: 32, type: 22 }sprite.rotation = 0.52; // 30°console.log(sprite.getBounds()); // Object { x: 0, y: 0, width: 32, height: 32, type: 22 }What's wrong?How can I get the correct bounds?
  7. Stephen Persson

    ..

    .
×
×
  • Create New...