Jump to content

Rope vs Plane


Taz
 Share

Recommended Posts

Hi, I'm looking at the documentation for Rope and Plane to try to see the difference and different use cases, but the use-case description and example construction are the same. It looks like the documentation for Plane is incorrect: the Plane constructor takes three arguments (texture, verticesX, verticesY), but the example passes only two arguments (texture, points). Shrug, I guess the Plane's use-case description and example were copied from Rope and never updated? So does anyone know when Plane is useful and maybe have a little example of creating one? Thanks in advance!

EDIT: I guess the plane is for stretching a texture across a rectangle, but I still wonder how to convert the width and height from pixels to number of vertices.

Link to comment
Share on other sites

You can use this branch: https://github.com/pixijs/pixi.js/pull/3842 , https://pixijs.download/dev-mesh-update/pixi.js ,  look at the plane: https://github.com/pixijs/pixi.js/blob/dev-mesh-update/src/mesh/Plane.js 

It allows to use texture width/height as pixels width/height. It also allows to override "_refreshVertices", change coordinates of every vertex based on grid coords.

Link to comment
Share on other sites

Okay, looks like I just set the width and height properties and verticesX/Y don't affect the plane's dimensions at all.

It seems like since Plane and Sprite both just use Container's width and height setters (which use scaling), then why would anyone use Plane instead of Sprite? Does setting verticesX and verticesY give control over the quality and that's its use case?

The dev branch doesn't use scaling to set the width and height so I guess a use case would be higher-quality scaling/stretching of a texture (vs scaling a Sprite). And from your comment, I guess a new use case would be breaking the texture into parts and rearranging the locations of parts?

Are there any other use cases / 'neat things' people are doing with the Plane class?

Thanks for the links and info @ivan.popelyshev

Link to comment
Share on other sites

Current dev version cant rearrange parts, only scale/stretch parts of texture. Basically, you can swap Sprite to Plane and make geometry effects on it, like waves. New rope is also a subclass of Plane: it respects texture width/height to make default arrangement of points, then you can change them.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...