你如何让 CCSprite 看起来像星球大战的介绍一样倾斜? [英] How do you make a CCSprite appear as slanting like the star wars intro?
问题描述
倾斜 x 和 y 坐标不会产生这种效果.关于如何实现这种效果的任何想法?我已经使用了 cccamera,但是没有关于如何正确实现它的示例.顺便说一句,这张图片来自 cocos2dx 尝试了 c++ 代码仍然无法工作
Skewing x and y coordinates doesn't give that kind of effect. Any ideas on how to achieve this kind of effect? I already use cccamera but there are no examples on how to properly implement this. This image btw is from cocos2dx tried the c++ code still didn't work
推荐答案
我觉得我需要一劳永逸地分享这个.因此,当您想要一个倾斜的 45 度或伪 3d 背景视图时,相机就是这样工作的:
I feel I need to share this once and for all. So this is how camera works when you want a slanting ,45degree or pseudo3d view of your background :
首先将你的导演设置为 3d 透视
First set your director to 3d perspective
[director_ setProjection:kCCDirectorProjection3D];
如果您只希望某些精灵以这种方式出现,请记住这一点所有节点都有摄像头(cocos2d v.3 似乎没有了,我不知道为什么)所以你这样做:
If you only want some of the sprites to appear this way then remember this all nodes have camera (cocos2d v.3 doesn't seem to have it anymore I don't know why) so you do this:
[mysprite.camera setEyeX:0 eyeY:-40 eyeZ:10];
[mysprite.camera setUpX:0 upY:0 upZ:1];
使用适合您需要的价值观.希望对其他人有所帮助!
Play with the values that fits your need. Hope it will help others!
这篇关于你如何让 CCSprite 看起来像星球大战的介绍一样倾斜?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!