hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
285 lines (126 loc) • 2.85 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [CollisionGroup](./server.collisiongroup.md)
## CollisionGroup enum
The default collision groups.
**Signature:**
```typescript
export declare enum CollisionGroup
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ALL
</td><td>
`65535`
</td><td>
</td></tr>
<tr><td>
BLOCK
</td><td>
`1`
</td><td>
</td></tr>
<tr><td>
ENTITY
</td><td>
`2`
</td><td>
</td></tr>
<tr><td>
ENTITY\_SENSOR
</td><td>
`4`
</td><td>
</td></tr>
<tr><td>
ENVIRONMENT\_ENTITY
</td><td>
`8`
</td><td>
</td></tr>
<tr><td>
GROUP\_1
</td><td>
`32`
</td><td>
</td></tr>
<tr><td>
GROUP\_10
</td><td>
`16384`
</td><td>
</td></tr>
<tr><td>
GROUP\_11
</td><td>
`32768`
</td><td>
</td></tr>
<tr><td>
GROUP\_2
</td><td>
`64`
</td><td>
</td></tr>
<tr><td>
GROUP\_3
</td><td>
`128`
</td><td>
</td></tr>
<tr><td>
GROUP\_4
</td><td>
`256`
</td><td>
</td></tr>
<tr><td>
GROUP\_5
</td><td>
`512`
</td><td>
</td></tr>
<tr><td>
GROUP\_6
</td><td>
`1024`
</td><td>
</td></tr>
<tr><td>
GROUP\_7
</td><td>
`2048`
</td><td>
</td></tr>
<tr><td>
GROUP\_8
</td><td>
`4096`
</td><td>
</td></tr>
<tr><td>
GROUP\_9
</td><td>
`8192`
</td><td>
</td></tr>
<tr><td>
PLAYER
</td><td>
`16`
</td><td>
</td></tr>
</tbody></table>
## Remarks
The collision groups are used to determine which objects collide and generate collision and contact force events. The default collision groups can be used for most entity and block interactions, but you may want to create your own for more complex scenarios. Up to 15 collision groups can be registered. Collision groups use pairwise filtering using bit masks.
This filtering method is based on two 16-bit values: - The belongsTo groups (the 16 left-most bits of `self.0`<!-- -->). - The collidesWith mask (the 16 right-most bits of `self.0`<!-- -->).
An interaction is allowed between two filters `a` and `b` two conditions are met simultaneously: - The belongsTo groups of `a` has at least one bit set to `1` in common with the collidesWith mask of `b`<!-- -->. - The belongsTo groups of `b` has at least one bit set to `1` in common with the collidesWith mask of `a`<!-- -->. In other words, interactions are allowed between two filter if the following condition is met:
```
((a >> 16) & b) != 0 && ((b >> 16) & a) != 0
```