⚛️ physics - 3D Fizik Motoru
Rigid Body, Collision, Constraints, Soft Body
86
Fonksiyon
1,089
Satır
34 KB
Boyut
🚀 Hızlı Başlangıç
içe_aktar physics
// 3D World
değişken world = physics.world_create([0.0, -9.81, 0.0])
// Ground plane
değişken ground = physics.body_create_static()
physics.body_add_shape(ground, physics.plane_shape([0.0, 1.0, 0.0], 0.0))
physics.world_add_body(world, ground)
// Sphere
değişken sphere = physics.body_create_dynamic(1.0)
physics.body_add_shape(sphere, physics.sphere_shape(0.5))
physics.body_set_position(sphere, [0.0, 10.0, 0.0])
physics.world_add_body(world, sphere)
// Simulate
her i içinde aralık(0, 100) için yap
physics.world_step(world, 1.0/60.0)
değişken pos = physics.body_get_position(sphere)
yazdır("t=" + i.yazıya() + ": y=" + pos[1].yazıya())
son
📚 Shapes
- Box, Sphere, Capsule, Cylinder, Cone
- Mesh (convex hull)
- Heightfield (terrain)