You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AmmoDriver.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,15 @@ An `ammo-body` component may be added to any entity in a scene. While having onl
134
134
The `type` of an ammo body can be one of the following:
135
135
136
136
-`dynamic`: A freely-moving object. Dynamic bodies have mass, collide with other bodies, bounce or slow during collisions, and fall if gravity is enabled.
137
+
137
138
-`static`: A fixed-position object. Other bodies may collide with static bodies, but static bodies themselves are unaffected by gravity and collisions. These bodies should typically not be moved after initialization as they cannot impart forces on `dynamic` bodies.
139
+
140
+
- If you do re-position a static object after initialization, you'll need to explicitly update the physics system with the new position. You can do that like this:
141
+
142
+
```
143
+
this.el.components['ammo-body'].syncToPhysics();
144
+
```
145
+
138
146
- `kinematic`: Like a `static` body, except that they can be moved via updating the position of the entity. Unlike a `static` body, they impart forces on `dynamic` bodies when moved. Useful for animated or remote (networked) objects.
139
147
140
148
#### Activation States
@@ -252,6 +260,10 @@ Any entity with an `ammo-body` component can also have 1 or more `ammo-shape` co
252
260
-`fit: all` – Requires a mesh to exist on the entity. The specified shape will be created to contain all the vertices of the mesh.
253
261
-`fit: manual` – Does not require a mesh, however you must specifiy either the `halfExtents` or `sphereRadius`manually. This is not supported for`hull`, `hacd`, `vhacd` and `mesh` types.
254
262
263
+
Note that in general, `fit: manual` is more performant than `fit: all`. This is because `fit: all` iterates over every point in the geometry to determine a suitable bounding volume, whereas `fit: manual` can just create the shape to the specified parameters. This is particularly important if you are going to be spawning newinstancesof objects while the physics simulation is ongoing.
264
+
265
+
Note that there is currently no caching of shapes generated from geometries, so even if you are creating shapes for the same geometry over & over you'll still pay this performance penalty for each new `ammo-shape`.
266
+
255
267
### `ammo-constraint`
256
268
257
269
The `ammo-constraint` component is used to bind `ammo-bodies` together using hinges, fixed distances, or fixed attachment points. Note that an `ammo-shape` is not required for `ammo-constraint` to work, however you may get strange results with some constraint types.
0 commit comments