FlipY3D does not flip at center position

Hi!

When I tryo to FlipY3D the layer of the default hello world template, the conent will flip but also move to upper corner.

So, it is not flipped a Y-Center position anymore. It worked with v2.2.6

Here is my code which I added to the end of the HelloWorldScene.init() method:

// add "HelloWorld" splash screen"
auto sprite = Sprite::create("HelloWorld.png");

// position the sprite on the center of the screen
sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

NodeGrid* lNodeGrid = NodeGrid::create();
this->addChild(lNodeGrid);
    
// add the sprite as a child to this layer
lNodeGrid->addChild(sprite, 0);
    
CCFlipY3D* mFlipScreenY3D = CCFlipY3D::create(1);
lNodeGrid->runAction(mFlipScreenY3D);

Can someone from cocos team please check this…

Dear cocos team. I really would love it if there would be more interest in community problems.
Is there no support who handles developer issues?

I have checked the test-cpp project of 2.2.6 and 3.8 and the FlipX3D and FlipY3D effects are not correct for 3.8.

Can you please check this or give a workaround?

created issue for this: https://github.com/cocos2d/cocos2d-x/issues/14057

Any update about this? Issue seems to be still open and no progress is visible.

Creating NodeGrid with the dimensions of the screen solved the problem for me:

NodeGrid* lNodeGrid = NodeGrid::create({origin, visibleSize});

Hi MausMausGames,

create mehtod does not accept any parameter.Can you show your code?

Thank you

Let me ask an Engineer to take a look at this.

Yes, it does.
From CCNodeGrid.h:

    static NodeGrid* create(const Rect& rect);

My code:

auto sprite = Sprite::create("HelloWorld.png");
sprite->setPosition(Vec2(visibleSize/2) + origin);

auto lNodeGrid = NodeGrid::create({origin, visibleSize});
this->addChild(lNodeGrid);

lNodeGrid->addChild(sprite);

lNodeGrid->runAction(FlipY3D::create(1));

Now it gets interesting… v3.6 does not have this overload for the create method. I will check this in 3.10 or try to set a GridBase for 3.6.

Thanks for the hint. I will give feedback about my try.

All this create method does is to set the grid rect. So doing this might do the job too:

lNodeGrid->setGridRect({origin, visibleSize});

added

auto origin = Director::getInstance()->getVisibleOrigin();
Size visibleSize = Director::getInstance()->getVisibleSize();
_gridNodeTarget = NodeGrid::create({origin, visibleSize });

of Line 345 of EffectsTest. So, the test application of cocos2d-x v3.x is working :smile: Maybe someone of the cocos team can fix that.

Yes, in 3.10 it is a GridRect in 3.6 a GridBase instance. I will check this later, if it is working in 3.6.

I didN’t get it to work with v3.6 but I moved the project to 3.10 and it is working now.

Thanks a lot!