3DMGAME 3DM首页 新闻中心 前瞻 | 评测 游戏库 热门 | 最新 攻略中心 攻略 | 秘籍 下载中心 游戏 | 汉化 购买正版 论坛

注册 登录

QQ登录

只需一步,快速开始

查看: 9813|回复: 21
打印 上一主题 下一主题

[求助] HDT Physics Extension的动态碰撞条件

  [复制链接]

4

主题

106

帖子

600

积分

超级玩家

Rank: 5Rank: 5

贡献度
4
金元
5841
积分
600
精华
0
注册时间
2011-7-31
跳转到指定楼层
主题
发表于 2014-8-2 23:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 君剑 于 2014-8-2 23:24 编辑

原帖:
HDT Physics Extension 开发者预览版【pre-α】
http://bbs.3dmgame.com/thread-3939772-1-1.html

我琢磨很久了,关于CollisionFilterInfo 的算法和碰撞条件始终看不懂,恰好,今天有时间,在网路上找到了一些资料,也翻出了氢姐当年的帖子,有了一些想法,虽然还不是很明白= =!
原帖中,有这么一段文字:
CollisionFilterInfo 计算:(GroupID<<24)|(GroupMask);
碰撞条件:若 (1<<IDA)&MaskB 且 (1<<IDB)&MaskA 则不碰撞
-1则不与任何物体碰撞

有点基础的话,(GroupID<<24)|(GroupMask)   还是很简单的。
简单说明一下
GroupID、GroupMask是两个变量,至于是怎么定义的,碰撞规则是怎样的我还不是很清楚= =!
这里我用a、b代替(十进制)
(a<<24)|(b):将a化成二进制数,然后"<<"的作用是将a左移两位右边补0,然后再和b的二进制数做或(|)运算,再化为十进制。这个十进制数就是CollisionFilterInfo的参数值。

(1<<IDA)&MaskB 则运用的是与运算。

以下摘自氢姐的帖子,个人翻译(由于这段英语很怪,翻译的不准确请见谅):


It's not decidedyet.

它尚未决定。

for now I just use abitfield. The highest 8 bits means which group it belong to(0-23, group>24means no collide with anything), and the lowest 24 bits means whether itcollide with a group(1=no collide).

现在我只使用一个位。高8位意味着某事物属于哪个group(0-23,group>24意味着与任何事物没有碰撞),而低24位意味着某事物是否与一个group发生碰撞(1 =无碰撞)。

you can use a win7build-in calcurator (program mode) to calcurate what you want.

你可以使用win7内置的程序计算器来计算你需要的参数。

it's calcurate underprogrammer mode(the 3rd mod, alt+3)

计算器第三型(程序计算器),快捷键是alt+3

if sth belongs to group 1 and will not collide with group 2 and 3:

如果某事物属于group 1,不会与group2、group3发生碰撞:

  
1.[Dec]
  
  
  
  
  
  
  
  
  
  
  
  
十进制
  


  
2.input group id
  
  
  
  
  
  
  
  
  
  
输入groupid
  


  
3.[Shl] 24
  
  
  
  
  
  
  
  
  
  
  
  
左移24位[Lsh 24]
  


  
4.[=]
  
  
  
  
  
  
  
  
  
  
  
  
计算
  

1 Lsh 24

  
5.[Bin]
  
  
  
  
  
  
  
  
  
  
  
  
二进制
  

Binary mode:

  
6.[Or]
  
  
  
  
  
  
  
  
  
  
  
  
或运算
  


  
7.input 24 bits  mask
  
  
  
  
  
  
  
  
  
  
输入24位mask
  

  
(the rightest is  group 0 and leftest is group 23)
  
  
  
  
(最右端为group0和最左边是group23)
  

Or  0000 0000 0000 0000 0000 1100


  
8.[=]
  
  
  
  
  
  
  
  
  
  
  
  
或计算
  



  
9.[Dec]
  
  
  
  
  
  
  
  
  
  
  
  
十进制
  

And this is what weneed:

and that is what youwant.

这就是你想要的。

The filter is the same as the one in MMD. if sth masked as no collide with group x, then it will no collide will all things belongs to group x.(x can be the group it belongs).

这个过滤器和MMD中的一样。如果事物被隐藏,与group x没有任何碰撞,那么它与group x.的所有事物都不会发生碰撞。(X可以是它所属的group)

the default filter(hkpGroupFilter) has 4 fields(5 bit per field) which make it much more difficult to calcurate, and it's really difficult to design.(because of the collision relationship between layers are fixed)

默认过滤器(hkpGroupFilter)有4个场(每个场有5位),这使得它更难以计算,这真的很难设计。(因为曾与层之间的碰撞关系是固定的)



那么,它的碰撞条件到底是怎么理解的呢?我不是很明白。


评分

1

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|3DMGAME ( 京ICP备14006952号-1  沪公网安备 31011202006753号

GMT+8, 2026-4-2 01:31 , Processed in 0.031881 second(s), 21 queries , Memcached On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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