New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
creator 2.0.1 worldToScreen求解 #3296
Comments
caochao
changed the title
creator 2.0.1哪个api对应cocos2dx中的projectGL方法?
creator 2.0.1 worldToScreen求解
Sep 20, 2018
@pandamicro 空闲的时候帮忙看看 |
额 ,没懂。老哥 意思是 官方的代码 这个 worldToScreen是有bug的么? |
minggo
added a commit
that referenced
this issue
Feb 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我们游戏cocos2dx版本用到了Camera做透视投影的近大远小效果,也用到了projectGL来计算屏幕坐标。目前我把游戏用creator改写的过程中由于自带的cocos2dx-lite移除了Camera,导致遇到一系列问题。
而我之前也有发帖提到过,我修改了cccamera的beforeDraw方法实现了针对节点N做透视投影。这次我想把节点N里的坐标C转化为屏幕坐标。
看到render-engine.js里有个worldToScreen方法,是把一个世界坐标乘以摄像机的视图和投影矩阵最终变化到视口坐标,应该和cocos2dx Camera里的projectGL方法是同样的作用。但是我调用这个方法无论传入什么世界坐标返回结果一直在ui设计尺寸的中心点左右, 设计尺寸是750*1334,返回结果一直近似于(375,667)。麻烦指点一下。
相关代码如下:
BattleCamera用来渲染PanelBattle。_temp_vec2是PanelBattle里一个点。
@pandamicro @jareguo
The text was updated successfully, but these errors were encountered: