Jump to content

Rotate sprite in PIXI Projection


codingjoe
 Share

Recommended Posts

You have some basics official demo provide by ivan ( Autor )
https://pixijs.io/examples/#/plugin-projection/iso-basic.js
and i have some customs experimental  playgrounds

https://www.pixiplayground.com/#/edit/gqBdNMjJxm_eVh2ag87CH

https://www.pixiplayground.com/#/edit/CRHMfHMsaM82X5EfCtNYe

https://www.pixiplayground.com/#/edit/ziTqfWG24v3A2ROJm6Y0o
 

and no, rotation should work both in 2d and 3d 
try look for proj.affine in 2d demo

forget euler is in 3d proj only, sorry for this.

https://pixijs.io/examples/#/plugin-projection/plane.js

3d + camera is maybe overkill for your need. 

 

Edited by jonforum
Link to comment
Share on other sites

42 minutes ago, codingjoe said:

@jonforum   I created an example: https://codepen.io/webdev-ux/pen/XWdYzvG

When the image is rotated, the width and height seem to be warped. I want to keep the ratio and height, width.

Do you understand understand what I mean ? The affine property doesn`t solve the problem because I want a normal rotation, without x or y axis. 

at line 46 try add 
 

bunny.proj.affine = 2; // or = PIXI.projection.AFFINE.AXIS_X 



console.log(bunny.proj); // show current setup for your sprite
console.log(PIXI.projection.AFFINE); // will show you all mode avaible (by no mutable key number)

is the type of rotation your search ?

  

42 minutes ago, codingjoe said:

When the image is rotated, the width and height seem to be warped. I want to keep the ratio and height, width.

Do you understand understand what I mean ? The affine property doesn`t solve the problem because I want a normal rotation, without x or y axis. 

I you want to keep the ratio and height, width.

Also try ` bunny.proj.scaleAfterAffine = false` to fix deformation if is what you need.
note that proj2d is limited, you will have to switch to proj3d for more possibilities and avoid some strange artifacts in some cases.

from my point of view.
Proj2d is more efficient and perfect for application engine. (with some limited transform behavior)
And proj3d is heavier and need a more complex ecosystem but great for games engine. (fix all transforms issu in proj2d)

Edited by jonforum
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...