Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:chipmunk [2014/12/12 15:35] alfred [Shapes] |
wiki2:chipmunk [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 21: | Línea 21: | ||
| ==== Code ==== | ==== Code ==== | ||
| + | === C++ === | ||
| + | |||
| <code cpp> | <code cpp> | ||
| // Create our ball's body with 100 mass and infinite moment | // Create our ball's body with 100 mass and infinite moment | ||
| - | cpBody *ballBody = cpBodyNew(100.0, INFINITY); | + | cpBody *ballBody = cpBodyNew(100.0, INFINITY); |
| // Set the initial position | // Set the initial position | ||
| ballBody->p = cpv(160, 250); | ballBody->p = cpv(160, 250); | ||
| Línea 29: | Línea 31: | ||
| cpSpaceAddBody(space, ballBody); | cpSpaceAddBody(space, ballBody); | ||
| </code> | </code> | ||
| + | |||
| + | === Python === | ||
| + | |||
| ===== Movement ===== | ===== Movement ===== | ||
| The main method of changing things on Chipmunk, just like in the real world, is to use and apply Forces. A force is a vector , you tell the strength along the XX and YY axis. To help working with vectors, Chipmunk comes with a library called cpVect that allows you to do the most common operations like multiplying vectors or projecting two vectors. | The main method of changing things on Chipmunk, just like in the real world, is to use and apply Forces. A force is a vector , you tell the strength along the XX and YY axis. To help working with vectors, Chipmunk comes with a library called cpVect that allows you to do the most common operations like multiplying vectors or projecting two vectors. | ||