你如何使CCSprite显示为像星球大战介绍那样倾斜? [英] How do you make a CCSprite appear as slanting like the star wars intro?

查看:98
本文介绍了你如何使CCSprite显示为像星球大战介绍那样倾斜?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

倾斜x和y坐标不会产生这种效果。任何想法如何实现这种效果?我已经使用cccamera,但没有示例如何正确实现这一点。这个图片btw来自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度或pseudo3d视图的背景:

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];

如果你只想让一些sprite出现这种方式,那么记住
所有节点有照相机(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆