博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
box2d游戏提示
阅读量:2384 次
发布时间:2019-05-10

本文共 1283 字,大约阅读时间需要 4 分钟。

I don't know well since I choose to use a Physics engine to process every interactions in my world.
Why not trying to set a large amount of mass for your player and a very tiny mass for others objects.
Then setting global gravity with 0,0 and processing each objects with a custom ApplyForce.
Tweaking player and objects friction.
Use contact points to control collision against wall and all others objects.
There is no SetPosition method for b2Body only with b2BodyDef.
RE-Creating each frame the body may not be the best solution... But who knows !
Box2d is based on Impulsion forces so it should be possible to reach such a result by tweaking objects values.
All depend on the way your player is moving and the forces applied to others objects (gravity, force, torque, etc.)
Another solution would be using sensors.
A sensor is a shape that detects collision but does not produce a response.
Add 2 shapes by object.
Set the first one as a sensor and add a collision mask to the second one in order to prevent collision with main character.
Then all you have to do is applying impulse / force to the object when is sensor overlap the main character.
Don't forget there is a Box2D forum ( 
 ) to ask question relative to Box2d itself ;) 

转载于:https://my.oschina.net/u/942328/blog/134707

你可能感兴趣的文章
Distributed Port Scanning: Creating an Nmap Cluster Using DNmap
查看>>
common sense security framework
查看>>
php-ids整合snort
查看>>
非捕获组的详解
查看>>
安全评估问题收集与整理
查看>>
IBM AppScan 7.8.1 更新安全规则库后出现“AppScan Severe Error: Failed to load rules/advisories file”错误的解决方案
查看>>
非常经典的SANS培训课程
查看>>
防火墙相关
查看>>
网络性能测试工具Iperf上手指南
查看>>
opensecuritytraining video
查看>>
collective intelligence framework
查看>>
2015年关注的技术书籍
查看>>
windows 2003 server 记录远程桌面的连接登录日志和修改3389连接端口方法
查看>>
samhain:比较变态的入侵检测系统
查看>>
Linux psacct文档
查看>>
使用setuptools自动安装python模块
查看>>
python IDE环境
查看>>
传说中的windows加固 -.... -
查看>>
windows目录监控软件
查看>>
Virus Bulletin malware分析杂志以及paper
查看>>