This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
es:orx:tutorials:physics [2012/03/03 08:12 (13 years ago)] – [Sumario] zera | es:orx:tutorials:physics [2020/08/19 21:14 (5 years ago)] (current) – Old content sausage | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tutorial de Física ====== | ||
- | |||
- | |||
- | |||
- | ===== Sumario ===== | ||
- | |||
- | Ver los anteriores [[main# | ||
- | |||
- | Este tutorial muestra como añadirle propiedades físicas a los objetos y manejar colisiones. | ||
- | |||
- | Como puedes ver, las propiedades físicas son completamente manipuladas por datos. Así, creando un objeto con propiedades físicas (ej. con un cuerpo) o sin ellas, resulta en exactamente la misma linea de código. | ||
- | |||
- | Los objetos pueden ser enlazados a un cuerpo, que puede ser estático o dinámico.\\ | ||
- | Cada cuerpo puede estar hecho de hasta 8 partes. | ||
- | |||
- | Un cuerpo es definido por: | ||
- | * su forma (actualmente caja, esfera y malla(ej. poligono convexo) son los únicos disponibles) | ||
- | * información acerca del tamaño de la forma (esquinas para la caja, centro y radio para la esfera, vértices para la malla) | ||
- | * Si el tamaño de los datos no es especificado, | ||
- | * las banderas propias de colisión definen esta parte | ||
- | * la máscara de chequeo de colisión define con que otra parte ella puede colisionar ((dos partes en el mismo cuerpo nuncá colisionarán)) | ||
- | * una bandera sólida('' | ||
- | * varios atributos como son restitución, | ||
- | |||
- | En este tutorial creamos muros estáticos sólidos alrededor de la pantalla. Entonces reproducimos cajas en el medio.\\ | ||
- | El número de cajas creadas serán ajustadas a través del fichero de configuración y es 100 por defecto. | ||
- | |||
- | |||
- | |||
- | The only interaction possible is using left and right mouse buttons (or left and right keys) to rotate the camera.\\ | ||
- | As we rotate it, we also update the gravity vector of our simulation.\\ | ||
- | Doing so, it gives the impression that the boxes will be always falling toward the bottom of our screen no matter how the camera is rotated. | ||
- | |||
- | We also register to the physics events to add a visual FXs on two colliding objects.\\ | ||
- | By default the FX is a fast color flash and is, as usual, tweakable in realtime | ||
- | (ie. reloading the config history will apply the new settings immediately as the FX isn't kept in cache by default). | ||
- | |||
- | Updating an object scale (including changing its scale with FXs) will update its physical properties (ie. its body).\\ | ||
- | Keep in mind that scaling an object with a physical body is more expensive as we have to delete the current shapes and recreate them at the correct size.\\ | ||
- | This is done this way as our current single physics plugin is based on Box2D which doesn' | ||
- | |||
- | This tutorial does only show basic physics and collision control, but, for example, you can also be notified with events for object separating or keeping contact. | ||
- | |||
- | ===== Detalles ===== | ||
- | |||
- | |||
- | |||
- | ===== Recursos ===== | ||
- | |||