找回密码
 注册
搜索
查看: 20286|回复: 7

[工作记录] 修改摄像机的小技巧

[复制链接]
发表于 2011-7-3 19:37:47 | 显示全部楼层 |阅读模式
其实大多数人会选用Peasycam 但是如果还涉及到鼠标操作会怎么办呢 对啊 可以用键值停用Peasycam 但是这样就略显麻烦了 特别是在android的操作上 其实问题不是那么难 给大家分享一个函数 这样可以很方便修改参数 虽然不能平移 但是可以很方便翻转 int offsetX = 0, offsetY = 0, clickX = 0, clickY = 0; float rotationX = 0, rotationY = 0, targetRotationX = 0, targetRotationY = 0, clickRotationX, clickRotationY; void mousePressed(){ clickX = mouseX; clickY = mouseY; clickRotationX = rotationX; clickRotationY = rotationY; } void setView() { translate(width*0.5,height*0.5); if (mousePressed) { offsetX = mouseX-clickX; offsetY = mouseY-clickY; targetRotationX = clickRotationX + offsetX/float(width) * TWO_PI; targetRotationY = min(max(clickRotationY + offsetY/float(height) * TWO_PI, -HALF_PI), HALF_PI); rotationX += (targetRotationX-rotationX)*0.25; rotationY += (targetRotationY-rotationY)*0.25; } rotateX(-rotationY); rotateY(rotationX); } setView() 的调用是在draw()函数中 void mousePressed()可以添加具体的鼠标按键 这种写法改android要方便很多
发表于 2011-7-3 21:22:42 | 显示全部楼层
嗯,这样做似乎要方便一些了。
回复

使用道具 举报

发表于 2011-7-4 14:47:21 | 显示全部楼层
panhao玩起android啦?
回复

使用道具 举报

发表于 2011-7-4 15:28:00 | 显示全部楼层
好的好的~值得一试~
回复

使用道具 举报

发表于 2011-7-7 19:12:00 | 显示全部楼层
学习了,很有用~
回复

使用道具 举报

发表于 2011-7-18 22:28:50 | 显示全部楼层
学到了,十分有用
回复

使用道具 举报

发表于 2011-9-2 08:24:49 | 显示全部楼层
0 2011年卫生资格考试考后分,数,修,改,加:81638567助你顺
回复

使用道具 举报

头像被屏蔽
发表于 2011-9-27 21:01:06 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

NCFZ微信公众号

手机版|小黑屋|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 ) 辽公网安备21021102000973号

GMT+8, 2026-11-23 18:30 , Processed in 0.041426 second(s), 21 queries , Gzip On.

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表