egret-docs-master/Engine3D/interactive/modelModel/README.md

43 lines
721 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## 模型与模型碰撞
### 原理:模型与模型碰撞其实就是检测各个面是否有相交。
这里为了更好的理解,我们将点想象成一个稍微大些的球。
* 未碰撞:
![image](575cd7d233cc3.png)
* 碰撞:
![image](575cd7d24143c.png)
### api
~~~
intersect ( target :egret3d.Bound, intersect :egret3d.Bound ):boolean
~~~
~~~
target:egret3d.Bound — 检测的目标
intersect:egret3d.Bound — 默认参数为null 相交的结果 可以为null
~~~
### 示例:
```
var result:boolean = cube.bound.intersect(ball.bound);
```
```
* cube一个方形模型
* intersect检测方法
* ball球形模型
* result 是否碰撞true 碰撞false 未碰撞
```