njin
Engine 2D gọn nhẹ để tự tay làm game theo ý mình. Vibe coding cũng ổn luôn
Loading...
Searching...
No Matches
njin_physics3d.h
1#pragma once
2#include "njin_3d.h"
3
4namespace njin {
5struct context;
6
9
16
27 vec3 position{0.0f, 0.0f, 0.0f};
28 vec3 rotation{0.0f, 0.0f, 0.0f};
29 vec3 size{1.0f, 1.0f, 1.0f};
30 f32 radius = 0.5f;
31 f32 height = 1.0f;
33 f32 mass = 1.0f;
34 f32 friction = 0.5f;
38 u64 user = 0;
43 vec3 scale{1.0f, 1.0f, 1.0f};
46 bool sensor = false;
47};
48
54body3d_handle body3d_create(context &ctx, const body3d_desc &desc);
55
59void body3d_destroy(context &ctx, body3d_handle handle);
60
65transform3d body3d_transform(const context &ctx, body3d_handle handle);
66
73void body3d_set_position(context &ctx, body3d_handle handle, vec3 position, vec3 rotation = {});
74
82void body3d_move_kinematic(context &ctx, body3d_handle handle, vec3 position, vec3 rotation = {});
83
88vec3 body3d_velocity(const context &ctx, body3d_handle handle);
89
94void body3d_set_velocity(context &ctx, body3d_handle handle, vec3 velocity);
95
101void body3d_add_impulse(context &ctx, body3d_handle handle, vec3 impulse);
102
110void body3d_add_force(context &ctx, body3d_handle handle, vec3 force);
111
125void body3d_add_force(context &ctx, body3d_handle handle, vec3 force, vec3 point);
126
133void body3d_add_torque(context &ctx, body3d_handle handle, vec3 torque);
134
140vec3 body3d_angular_velocity(const context &ctx, body3d_handle handle);
141
152void body3d_carry(context &ctx, body3d_handle handle, f32 mass, vec3 point);
153
158u64 body3d_user(const context &ctx, body3d_handle handle);
159
164 vec3 position{0.0f, 0.0f, 0.0f};
165 f32 radius = 0.3f;
166 f32 height = 1.8f;
167 f32 max_slope = 50.0f;
172 f32 mass = 70.0f;
178 bool push = false;
179};
180
189
193void character3d_destroy(context &ctx, character3d_handle handle);
194
205void character3d_set_active(context &ctx, character3d_handle handle, bool active);
206
211bool character3d_active(const context &ctx, character3d_handle handle);
212
217void character3d_set_velocity(context &ctx, character3d_handle handle, vec3 velocity);
218
223vec3 character3d_velocity(const context &ctx, character3d_handle handle);
224
229vec3 character3d_position(const context &ctx, character3d_handle handle);
230
235void character3d_set_position(context &ctx, character3d_handle handle, vec3 position);
236
241bool character3d_grounded(const context &ctx, character3d_handle handle);
242
249
255
264
280vec3 physics3d_capsule_push(const context &ctx, vec3 a, vec3 b, f32 radius, body3d_handle ignore = {});
281
290vec3 physics3d_box_push(const context &ctx, vec3 center, vec3 rotation, vec3 size, body3d_handle ignore = {});
291
309ray3d_hit physics3d_box_cast(const context &ctx, vec3 center, vec3 rotation, vec3 size, vec3 motion,
310 body3d_handle ignore = {}, body3d_handle *body = nullptr);
311
319
332ray3d_hit physics3d_box_cast(const context &ctx, vec3 center, vec3 rotation, vec3 size, vec3 motion,
333 body3d_handle ignore, body3d_handle *body, soft3d_hit *soft);
334
349hull3d_handle physics3d_hull_create(context &ctx, const vec3 *points, i32 count);
350
354void physics3d_hull_destroy(context &ctx, hull3d_handle hull);
355
363vec3 physics3d_hull_push(const context &ctx, hull3d_handle hull, vec3 position, vec3 rotation, body3d_handle ignore = {});
364
374ray3d_hit physics3d_hull_cast(const context &ctx, hull3d_handle hull, vec3 position, vec3 rotation, vec3 motion,
375 body3d_handle ignore = {}, body3d_handle *body = nullptr);
376
387ray3d_hit physics3d_hull_cast(const context &ctx, hull3d_handle hull, vec3 position, vec3 rotation, vec3 motion,
388 body3d_handle ignore, body3d_handle *body, soft3d_hit *soft);
389
396i32 physics3d_hull_lines(const context &ctx, hull3d_handle hull, vec3 *out, i32 count);
397
405ray3d_hit physics3d_raycast(const context &ctx, const ray3d &ray, f32 max_distance,
406 body3d_handle *body = nullptr);
407
426ray3d_hit physics3d_raycast(const context &ctx, const ray3d &ray, f32 max_distance, body3d_handle *body,
427 soft3d_hit *soft);
428
431struct contact3d {
435 bool began = true;
436 bool sensor = false;
437 vec3 point{0.0f, 0.0f, 0.0f};
439 vec3 normal{0.0f, 0.0f, 0.0f};
440};
441
459i32 physics3d_contact_count(const context &ctx);
460
465contact3d physics3d_contact(const context &ctx, i32 index);
466
485
493 vec3 anchor{0.0f, 0.0f, 0.0f};
494 vec3 anchor_b{0.0f, 0.0f, 0.0f};
495 vec3 axis{0.0f, 1.0f, 0.0f};
503 f32 min = 0.0f;
504 f32 max = 0.0f;
512 f32 spring = 0.0f;
514 f32 damping = 0.0f;
527 f32 ratio = 1.0f;
528 vec3 pulley_a{0.0f, 0.0f, 0.0f};
529 vec3 pulley_b{0.0f, 0.0f, 0.0f};
530};
531
543joint3d_handle joint3d_create(context &ctx, const joint3d_desc &desc);
544
548void joint3d_destroy(context &ctx, joint3d_handle handle);
549
555void joint3d_set_motor(context &ctx, joint3d_handle handle, f32 speed);
556
562f32 joint3d_position(const context &ctx, joint3d_handle handle);
563
579void joint3d_set_motor_force(context &ctx, joint3d_handle handle, f32 force);
580
586f32 joint3d_speed(const context &ctx, joint3d_handle handle);
587
594f32 joint3d_force(const context &ctx, joint3d_handle handle);
595
605f32 joint3d_torque(const context &ctx, joint3d_handle handle);
606
614 const char *name = nullptr;
617 f32 radius = 0.0f;
621 f32 length = 0.0f;
623 f32 swing = 30.0f;
624 f32 twist = 15.0f;
629 f32 bend_min = 0.0f;
630 f32 bend_max = 0.0f;
631};
632
649
676
680void ragdoll3d_destroy(context &ctx, ragdoll3d_handle handle);
681
689body3d_handle ragdoll3d_body(const context &ctx, ragdoll3d_handle handle, i32 part);
690
699shape3d ragdoll3d_shape(const context &ctx, ragdoll3d_handle handle, i32 part);
700
716i32 ragdoll3d_bones(const context &ctx, ragdoll3d_handle handle, const transform3d &transform, bone_pose3d *out,
717 i32 count);
718
731
740 vec3 position{0.0f, 0.0f, 0.0f};
741 vec3 rotation{0.0f, 0.0f, 0.0f};
742 vec3 size{1.0f, 1.0f, 1.0f};
743 f32 radius = 0.5f;
754 vec3 scale{1.0f, 1.0f, 1.0f};
755 f32 mass = 1.0f;
759 f32 bend = 0.5f;
764 f32 pressure = 0.0f;
765 f32 friction = 0.5f;
767 f32 damping = 0.1f;
770 f32 drag = 1.0f;
773 const u32 *pinned = nullptr;
775 u64 user = 0;
780 bool collide_soft = true;
785 bool walkable = true;
786};
787
806
814
821 vec3 position{0.0f, 0.0f, 0.0f};
822 vec3 rotation{0.0f, 0.0f, 0.0f};
823 vec2 size{2.0f, 2.0f};
825 i32 rows = 20;
826 f32 mass = 0.5f;
827 f32 stiffness = 1.0f;
828 f32 bend = 0.05f;
829 f32 damping = 0.1f;
830 f32 friction = 0.5f;
831 f32 drag = 1.0f;
834 f32 thickness = 0.02f;
836 const u32 *pinned = nullptr;
838 u64 user = 0;
839 bool collide_soft = true;
840 bool walkable = true;
841};
842
857
861void softbody3d_destroy(context &ctx, softbody3d_handle handle);
862
868
875i32 softbody3d_vertices(const context &ctx, softbody3d_handle handle, vec3 *out, i32 count);
876
884i32 softbody3d_normals(const context &ctx, softbody3d_handle handle, vec3 *out, i32 count);
885
893i32 softbody3d_indices(const context &ctx, softbody3d_handle handle, u32 *out, i32 count);
894
904
910i32 softbody3d_nearest(const context &ctx, softbody3d_handle handle, vec3 point);
911
918void softbody3d_pin(context &ctx, softbody3d_handle handle, i32 vertex, bool pinned);
919
927void softbody3d_move_pinned(context &ctx, softbody3d_handle handle, i32 vertex, vec3 position);
928
936void softbody3d_set_wind(context &ctx, softbody3d_handle handle, vec3 wind);
937
943void softbody3d_add_impulse(context &ctx, softbody3d_handle handle, vec3 impulse);
944
949vec3 softbody3d_position(const context &ctx, softbody3d_handle handle);
950
955u64 softbody3d_user(const context &ctx, softbody3d_handle handle);
956
962void softbody3d_draw_debug(context &ctx, softbody3d_handle handle, rgba color = {0.3f, 0.9f, 1.0f, 1.0f});
963
968 vec3 position{0.0f, 0.0f, 0.0f};
969 f32 radius = 0.35f;
970 f32 width = 0.25f;
971 bool steer = false;
972 bool drive = true;
973 bool handbrake = false;
974};
975
980 vec3 position{0.0f, 0.0f, 0.0f};
981 vec3 rotation{0.0f, 0.0f, 0.0f};
982 vec3 size{1.8f, 0.6f, 4.0f};
984 vec3 scale{1.0f, 1.0f, 1.0f};
985 f32 mass = 1200.0f;
987 vec3 center_of_mass{0.0f, -0.3f, 0.0f};
990 const vehicle3d_wheel *wheels = nullptr;
993 f32 wheel_width = 0.25f;
997 f32 max_steer = 30.0f;
1001 f32 max_rpm = 6000.0f;
1002 f32 brake_torque = 1500.0f;
1004 f32 friction = 0.5f;
1005 u64 user = 0;
1006};
1007
1024
1028void vehicle3d_destroy(context &ctx, vehicle3d_handle handle);
1029
1040void vehicle3d_set_input(context &ctx, vehicle3d_handle handle, f32 throttle, f32 steer, f32 brake, f32 handbrake);
1041
1048
1053i32 vehicle3d_wheel_count(const context &ctx, vehicle3d_handle handle);
1054
1063
1069bool vehicle3d_wheel_grounded(const context &ctx, vehicle3d_handle handle, i32 wheel);
1070
1075f32 vehicle3d_rpm(const context &ctx, vehicle3d_handle handle);
1076
1081i32 vehicle3d_gear(const context &ctx, vehicle3d_handle handle);
1082
1088 vec3 position{0.0f, 0.0f, 0.0f};
1089 vec3 rotation{0.0f, 0.0f, 0.0f};
1090 vec3 size{0.4f, 0.6f, 0.8f};
1092 vec3 scale{1.0f, 1.0f, 1.0f};
1093 f32 mass = 240.0f;
1094 vec3 center_of_mass{0.0f, -0.3f, 0.0f};
1099 f32 caster = 30.0f;
1100 f32 max_steer = 30.0f;
1101 f32 max_lean = 45.0f;
1103 f32 max_rpm = 10000.0f;
1105 f32 friction = 0.5f;
1106 u64 user = 0;
1107};
1108
1124
1130 vec3 position{0.0f, 0.0f, 0.0f};
1131 vec3 rotation{0.0f, 0.0f, 0.0f};
1132 vec3 size{3.4f, 1.0f, 6.4f};
1134 vec3 scale{1.0f, 1.0f, 1.0f};
1135 f32 mass = 4000.0f;
1136 vec3 center_of_mass{0.0f, -0.5f, 0.0f};
1142 f32 max_rpm = 6000.0f;
1143 f32 brake_torque = 15000.0f;
1144 f32 friction = 0.5f;
1145 u64 user = 0;
1146};
1147
1157
1166void vehicle3d_set_tracks(context &ctx, vehicle3d_handle handle, f32 left, f32 right, f32 brake);
1167
1173f32 vehicle3d_track_speed(const context &ctx, vehicle3d_handle handle, i32 side);
1174
1181void vehicle3d_draw_debug(context &ctx, vehicle3d_handle handle, rgba color = {1.0f, 0.6f, 0.2f, 1.0f});
1182
1202
1209
1214void physics3d_set_gravity(context &ctx, vec3 gravity);
1215
1219vec3 physics3d_gravity(const context &ctx);
1221} // namespace njin
shape3d_kind
Loại hình của njin::shape3d.
Definition njin_3d.h:248
@ shape3d_box
Hộp: size, bo cạnh theo rounding.
Definition njin_3d.h:250
void joint3d_set_motor_force(context &ctx, joint3d_handle handle, f32 force)
Đổi lực tối đa của mô-tơ (joint3d_desc::motor_force) lúc đang chạy: chân ga, động cơ dây chun yếu dần...
void softbody3d_pin(context &ctx, softbody3d_handle handle, i32 vertex, bool pinned)
Ghim hay bỏ ghim một đỉnh.
transform3d vehicle3d_wheel_transform(const context &ctx, vehicle3d_handle handle, i32 wheel)
Chỗ và góc của một bánh lúc này (đã tính giảm xóc, góc lái và bánh quay), trong thế giới.
u64 softbody3d_user(const context &ctx, softbody3d_handle handle)
Số của game gắn vào vật mềm lúc tạo.
vec3 body3d_angular_velocity(const context &ctx, body3d_handle handle)
Vận tốc góc của body: trục quay là hướng của vector, độ mỗi giây là độ dài của nó (quy tắc bàn tay ph...
void character3d_destroy(context &ctx, character3d_handle handle)
Hủy nhân vật.
f32 joint3d_position(const context &ctx, joint3d_handle handle)
Góc hiện tại của bản lề (độ) hoặc quãng trượt của khớp trượt (đơn vị), tính từ lúc tạo khớp.
vec3 character3d_position(const context &ctx, character3d_handle handle)
Vị trí chân của nhân vật.
void vehicle3d_destroy(context &ctx, vehicle3d_handle handle)
Hủy xe cùng thân xe.
vehicle3d_handle motorcycle3d_create(context &ctx, const motorcycle3d_desc &desc)
Tạo một xe máy (bộ điều khiển xe máy của Jolt): một lò xo giữ xe đứng thẳng và nghiêng vào cua theo t...
contact3d physics3d_contact(const context &ctx, i32 index)
Sự kiện chạm thứ index của bước mô phỏng vừa rồi.
void softbody3d_set_wind(context &ctx, softbody3d_handle handle, vec3 wind)
Đặt gió thổi qua vật mềm, vận tốc của không khí (đơn vị mỗi giây).
cloth3d_edge
Các cạnh của tấm vải, cộng lại được: cloth3d_top | cloth3d_left.
Definition njin_physics3d.h:808
void vehicle3d_draw_debug(context &ctx, vehicle3d_handle handle, rgba color={1.0f, 0.6f, 0.2f, 1.0f})
Vẽ xe bằng gizmo (njin_gizmo.h) cho frame này: hộp thân xe, mỗi bánh là một vòng tròn với trục,...
joint3d_kind
Loại khớp nối của njin::joint3d_desc.
Definition njin_physics3d.h:468
ray3d_hit physics3d_box_cast(const context &ctx, vec3 center, vec3 rotation, vec3 size, vec3 motion, body3d_handle ignore={}, body3d_handle *body=nullptr)
Đẩy một hộp đi theo motion và tìm thứ đầu tiên nó chạm (không tính nhân vật, sensor,...
vec3 softbody3d_position(const context &ctx, softbody3d_handle handle)
Tâm của vật mềm (trung bình các đỉnh), để camera đi theo hay đặt âm thanh.
f32 vehicle3d_rpm(const context &ctx, vehicle3d_handle handle)
Vòng tua động cơ lúc này, cho tiếng máy và đồng hồ.
softbody3d_kind
Hình dựng sẵn của một vật mềm (njin::softbody3d_desc::kind).
Definition njin_physics3d.h:720
void body3d_set_position(context &ctx, body3d_handle handle, vec3 position, vec3 rotation={})
Dời body tức thời tới vị trí mới (dịch chuyển, không va chạm trên đường đi), ví dụ khi đặt lại màn ch...
void body3d_carry(context &ctx, body3d_handle handle, f32 mass, vec3 point)
Cho bước vật lý kế tiếp, body động mang thêm một vật nặng mass kg đặt tại point: người treo hay leo t...
ray3d_hit physics3d_raycast(const context &ctx, const ray3d &ray, f32 max_distance, body3d_handle *body=nullptr)
Bắn một tia vào các body (không trúng nhân vật, đi xuyên sensor): đạn, tầm nhìn, chọn vật bằng chuột.
vec3 physics3d_gravity(const context &ctx)
Trọng lực đang dùng cho body động.
vec3 body3d_velocity(const context &ctx, body3d_handle handle)
Vận tốc thẳng của body, đơn vị mỗi giây.
void joint3d_destroy(context &ctx, joint3d_handle handle)
Hủy khớp.
i32 softbody3d_normals(const context &ctx, softbody3d_handle handle, vec3 *out, i32 count)
Pháp tuyến hiện tại của các đỉnh (độ dài 1, trung bình các tam giác chung đỉnh, hướng ra ngoài hay về...
shape3d ragdoll3d_shape(const context &ctx, ragdoll3d_handle handle, i32 part)
Hình va chạm của một phần, trong thế giới: viên nang (hoặc hình cầu) mà engine đo từ da,...
model_handle softbody3d_model(context &ctx, softbody3d_handle handle)
Một model luôn có hình hiện tại của vật mềm, trong thế giới: engine cập nhật nó sau mỗi bước vật lý.
u64 body3d_user(const context &ctx, body3d_handle handle)
Số của game gắn vào body lúc tạo (njin::body3d_desc::user).
void body3d_add_impulse(context &ctx, body3d_handle handle, vec3 impulse)
Đẩy một body động một cú (xung lực, kg * đơn vị mỗi giây) tại tâm của nó: nổ, cú đá,...
vec3 character3d_velocity(const context &ctx, character3d_handle handle)
Vận tốc sau bước mô phỏng vừa rồi (đã bị tường, sàn chặn bớt).
void body3d_move_kinematic(context &ctx, body3d_handle handle, vec3 position, vec3 rotation={})
Cho một body kinematic tới position sau bước mô phỏng tới.
joint3d_handle joint3d_create(context &ctx, const joint3d_desc &desc)
Nối hai body (hoặc một body với thế giới) bằng một khớp.
void joint3d_set_motor(context &ctx, joint3d_handle handle, f32 speed)
Đặt tốc độ mô-tơ của một bản lề (độ mỗi giây) hay khớp trượt (đơn vị mỗi giây), trong giới hạn joint3...
ray3d_hit physics3d_hull_cast(const context &ctx, hull3d_handle hull, vec3 position, vec3 rotation, vec3 motion, body3d_handle ignore={}, body3d_handle *body=nullptr)
Như physics3d_box_cast() cho một khối lồi.
i32 physics3d_contact_count(const context &ctx)
Số sự kiện chạm của bước mô phỏng vừa rồi.
i32 softbody3d_vertex_count(const context &ctx, softbody3d_handle handle)
Số đỉnh của vật mềm.
void character3d_set_position(context &ctx, character3d_handle handle, vec3 position)
Dời nhân vật tức thời tới vị trí chân mới (hồi sinh, cổng dịch chuyển).
void body3d_add_force(context &ctx, body3d_handle handle, vec3 force)
Đẩy một body động bằng một lực (N, kg * đơn vị mỗi giây²) tại trọng tâm, trong bước vật lý tới: động ...
body3d_handle ragdoll3d_body(const context &ctx, ragdoll3d_handle handle, i32 part)
Body của một phần, để đẩy (body3d_add_impulse()), đọc vị trí, hay nhận ra phần bị trúng trong physics...
i32 softbody3d_indices(const context &ctx, softbody3d_handle handle, u32 *out, i32 count)
Các tam giác của mặt vật mềm, ba chỉ số đỉnh mỗi tam giác, ngược chiều kim đồng hồ nhìn từ ngoài (từ ...
body3d_motion
Cách một body vật lý 3D chuyển động.
Definition njin_physics3d.h:11
void body3d_destroy(context &ctx, body3d_handle handle)
Hủy body.
ragdoll3d_handle ragdoll3d_create(context &ctx, const ragdoll3d_desc &desc)
Biến một model có xương thành ragdoll: mỗi phần là một body động, nối với phần cha bằng khớp có giới ...
bool character3d_grounded(const context &ctx, character3d_handle handle)
Nhân vật có đang đứng trên thứ gì đủ bằng phẳng không (sau bước mô phỏng vừa rồi).
vec3 physics3d_box_push(const context &ctx, vec3 center, vec3 rotation, vec3 size, body3d_handle ignore={})
Như physics3d_capsule_push() cho một hộp (bàn chân, bàn tay đo từ da bằng model_bone_bounds()).
bool character3d_active(const context &ctx, character3d_handle handle)
Nhân vật có đang bật không (character3d_set_active()).
f32 joint3d_speed(const context &ctx, joint3d_handle handle)
Tốc độ hiện tại của bản lề (độ mỗi giây, cùng chiều với joint3d_position()) hoặc của khớp trượt (đơn ...
void vehicle3d_set_input(context &ctx, vehicle3d_handle handle, f32 throttle, f32 steer, f32 brake, f32 handbrake)
Đặt cách lái cho bước vật lý tới.
void softbody3d_move_pinned(context &ctx, softbody3d_handle handle, i32 vertex, vec3 position)
Cho một đỉnh bị ghim tới position sau bước vật lý tới, kéo phần còn lại theo: áo choàng ghim vào vai ...
void softbody3d_draw_debug(context &ctx, softbody3d_handle handle, rgba color={0.3f, 0.9f, 1.0f, 1.0f})
Vẽ vật mềm bằng gizmo (njin_gizmo.h) cho frame này: các cạnh của mặt, và đỉnh bị ghim là chấm đỏ.
softbody3d_handle cloth3d_create(context &ctx, const cloth3d_desc &desc)
Tạo một tấm vải: lá cờ, rèm, áo choàng, khăn trải bàn.
vec3 physics3d_capsule_push(const context &ctx, vec3 a, vec3 b, f32 radius, body3d_handle ignore={})
Vector đẩy ngắn nhất (minimum translation vector) đưa viên nang a–b bán kính radius ra khỏi mọi body ...
void physics3d_hull_destroy(context &ctx, hull3d_handle hull)
Hủy khối.
i32 softbody3d_nearest(const context &ctx, softbody3d_handle handle, vec3 point)
Đỉnh gần point nhất, để ghim hay kéo một chỗ của vật mềm.
f32 joint3d_force(const context &ctx, joint3d_handle handle)
Lực khớp đang chịu để giữ hai body theo luật của nó (giữ điểm nối, giới hạn, mô-tơ,...
void character3d_set_active(context &ctx, character3d_handle handle, bool active)
Bật hoặc tắt một nhân vật.
i32 ragdoll3d_bones(const context &ctx, ragdoll3d_handle handle, const transform3d &transform, bone_pose3d *out, i32 count)
Tư thế hiện tại của ragdoll, để vẽ model bằng model_pose::bones ở transform (thường là ragdoll3d_desc...
vec3 physics3d_hull_push(const context &ctx, hull3d_handle hull, vec3 position, vec3 rotation, body3d_handle ignore={})
Như physics3d_box_push() cho một khối lồi đặt ở position, xoay rotation.
i32 vehicle3d_wheel_count(const context &ctx, vehicle3d_handle handle)
Số bánh của xe.
void softbody3d_destroy(context &ctx, softbody3d_handle handle)
Hủy vật mềm cùng model của nó (softbody3d_model()).
void ragdoll3d_destroy(context &ctx, ragdoll3d_handle handle)
Hủy ragdoll cùng các body của nó.
void vehicle3d_set_tracks(context &ctx, vehicle3d_handle handle, f32 left, f32 right, f32 brake)
Điều khiển thẳng hai dải xích của xe bánh xích cho bước vật lý tới, giữ nguyên tới lần gọi sau: mỗi b...
void body3d_add_torque(context &ctx, body3d_handle handle, vec3 torque)
Xoay một body động bằng một mô-men (N·m) quanh trọng tâm, trong bước vật lý tới.
hull3d_handle physics3d_hull_create(context &ctx, const vec3 *points, i32 count)
Dựng một khối lồi từ các điểm (khối nhỏ nhất bọc hết chúng), để dò va chạm bằng đúng hình của một bộ ...
softbody3d_handle character3d_ground_soft(const context &ctx, character3d_handle handle)
Vật mềm mà nhân vật đang đứng lên (nệm, bạt nhún, softbody3d_desc::walkable).
f32 joint3d_torque(const context &ctx, joint3d_handle handle)
Mô-men khớp đang chịu để giữ góc giữa hai body (bản lề giữ trục, giới hạn góc, mô-tơ,...
vehicle3d_handle tracked3d_create(context &ctx, const tracked3d_desc &desc)
Tạo một xe bánh xích (bộ điều khiển xe xích của Jolt): rẽ bằng cách cho hai dải xích chạy khác tốc độ...
softbody3d_handle softbody3d_create(context &ctx, const softbody3d_desc &desc)
Tạo một vật mềm.
body3d_handle vehicle3d_body(const context &ctx, vehicle3d_handle handle)
Thân xe, để đọc vị trí (body3d_transform()), vận tốc, hay đẩy nó.
body3d_handle body3d_create(context &ctx, const body3d_desc &desc)
Tạo một body vật lý 3D.
void character3d_set_velocity(context &ctx, character3d_handle handle, vec3 velocity)
Đặt vận tốc muốn có cho bước mô phỏng tới, đơn vị mỗi giây.
void softbody3d_add_impulse(context &ctx, softbody3d_handle handle, vec3 impulse)
Đẩy cả vật mềm một cú (xung lực, kg * đơn vị mỗi giây), chia đều cho các đỉnh không bị ghim: cú đá và...
f32 vehicle3d_track_speed(const context &ctx, vehicle3d_handle handle, i32 side)
Tốc độ của một dải xích, để cuộn ảnh xích theo đúng tốc độ xe chạy.
i32 vehicle3d_gear(const context &ctx, vehicle3d_handle handle)
Số đang vào: -1 số lùi, 0 số không, 1 trở lên là số tiến.
void physics3d_set_gravity(context &ctx, vec3 gravity)
Đặt trọng lực cho body động.
i32 softbody3d_vertices(const context &ctx, softbody3d_handle handle, vec3 *out, i32 count)
Vị trí hiện tại của các đỉnh, trong thế giới.
character3d_handle character3d_create(context &ctx, const character3d_desc &desc)
Tạo một nhân vật.
vec3 character3d_ground_velocity(const context &ctx, character3d_handle handle)
Vận tốc của thứ nhân vật đang đứng lên: bằng 0 trên sàn tĩnh, bằng vận tốc của bục trên một body kine...
bool vehicle3d_wheel_grounded(const context &ctx, vehicle3d_handle handle, i32 wheel)
Bánh có đang chạm đất không.
body3d_handle character3d_ground_body(const context &ctx, character3d_handle handle)
Body mà nhân vật đang đứng lên (để biết đã tới bục nào).
i32 physics3d_hull_lines(const context &ctx, hull3d_handle hull, vec3 *out, i32 count)
Các cạnh của khối, từng cặp điểm trong hệ trục riêng của nó, để vẽ debug.
transform3d body3d_transform(const context &ctx, body3d_handle handle)
Vị trí và góc xoay hiện tại của body, để vẽ nó (scale luôn là 1).
vehicle3d_handle vehicle3d_create(context &ctx, const vehicle3d_desc &desc)
Tạo một xe có bánh: thân xe là body động, mỗi bánh là một giảm xóc dò mặt đất (không phải body),...
void body3d_set_velocity(context &ctx, body3d_handle handle, vec3 velocity)
Đặt vận tốc thẳng của một body động.
@ cloth3d_left
Cột đầu (cột 0).
Definition njin_physics3d.h:811
@ cloth3d_right
Cột cuối.
Definition njin_physics3d.h:812
@ cloth3d_bottom
Hàng cuối.
Definition njin_physics3d.h:810
@ cloth3d_top
Hàng đầu (hàng 0).
Definition njin_physics3d.h:809
@ joint3d_hinge
Bản lề: xoay quanh axis qua anchor (cửa, bập bênh, bánh xe).
Definition njin_physics3d.h:471
@ joint3d_distance
Giữ khoảng cách giữa anchor và anchor_b trong [min, max] (dây, thanh nối).
Definition njin_physics3d.h:473
@ joint3d_gear
Bánh răng: buộc hai bản lề joint_a, joint_b quay theo tỉ số ratio (bánh răng ăn khớp,...
Definition njin_physics3d.h:476
@ joint3d_pulley
Ròng rọc: dây từ anchor trên a vắt qua điểm cố định pulley_a, sang pulley_b rồi xuống anchor_b trên b...
Definition njin_physics3d.h:483
@ joint3d_fixed
Hàn cứng hai body: giữ nguyên vị trí và góc tương đối.
Definition njin_physics3d.h:469
@ joint3d_rack
Thanh răng: buộc bản lề joint_a (bánh) và khớp trượt joint_b (thanh) đi cùng nhau: thanh trượt ratio ...
Definition njin_physics3d.h:479
@ joint3d_slider
Trượt dọc axis, không xoay (piston, ngăn kéo, cửa kéo).
Definition njin_physics3d.h:472
@ joint3d_point
Khớp cầu: xoay tự do quanh anchor (dây xích, ragdoll).
Definition njin_physics3d.h:470
@ softbody3d_sphere
Mặt cầu bán kính radius, rỗng: thêm pressure để thành quả bóng.
Definition njin_physics3d.h:725
@ softbody3d_mesh
Mặt của một lưới tam giác (mesh, hoặc mọi lưới của model), rỗng như mặt cầu: lưới kín và đặt pressure...
Definition njin_physics3d.h:729
@ softbody3d_box
Khối hộp đặc size: một lưới điểm đều bên trong hộp, giữ thể tích.
Definition njin_physics3d.h:723
@ body3d_kinematic
Game dời bằng body3d_move_kinematic(): bục di chuyển, cửa. Không bị vật khác đẩy, nhưng chở và đẩy đư...
Definition njin_physics3d.h:13
@ body3d_static
Đứng yên mãi: sàn, tường, bục cố định. Rẻ nhất.
Definition njin_physics3d.h:12
@ body3d_dynamic
Do vật lý điều khiển: rơi, va, lăn, bị đẩy. Thùng, bóng, mảnh vỡ.
Definition njin_physics3d.h:14
std::uint8_t u8
Số nguyên không dấu 8 bit.
Definition _types.h:20
std::int32_t i32
Số nguyên có dấu 32 bit.
Definition _types.h:14
std::uint64_t u64
Số nguyên không dấu 64 bit.
Definition _types.h:23
float f32
Số thực 32 bit.
Definition _types.h:28
std::uint32_t u32
Số nguyên không dấu 32 bit.
Definition _types.h:22
Mô tả một body vật lý 3D cho body3d_create().
Definition njin_physics3d.h:25
model_handle model
Lấy hình từ model này (model_load()) thay cho shape.
Definition njin_physics3d.h:42
f32 height
Chiều cao cả hình theo y (viên nang, trụ).
Definition njin_physics3d.h:31
shape3d_kind shape
Hình: hộp, cầu, viên nang hoặc trụ.
Definition njin_physics3d.h:26
vec3 size
Kích thước của hộp theo x, y, z.
Definition njin_physics3d.h:29
vec3 position
Tâm.
Definition njin_physics3d.h:27
vec3 rotation
Góc xoay, độ, cùng thứ tự với njin::transform3d.
Definition njin_physics3d.h:28
f32 friction
Ma sát, 0..1.
Definition njin_physics3d.h:34
u64 user
Số của game gắn vào body (chỉ số trong mảng, id entity...), đọc lại bằng body3d_user() hoặc từ kết qu...
Definition njin_physics3d.h:38
f32 radius
Bán kính (cầu, viên nang, trụ).
Definition njin_physics3d.h:30
vec3 scale
Tỉ lệ của model, như njin::transform3d::scale.
Definition njin_physics3d.h:43
f32 mass
Khối lượng, kg, chỉ cho body động.
Definition njin_physics3d.h:33
body3d_motion motion
Cách chuyển động.
Definition njin_physics3d.h:32
f32 restitution
Độ nảy, 0 (không nảy) .
Definition njin_physics3d.h:35
bool sensor
Chỉ phát hiện, không va chạm: vật và nhân vật đi xuyên qua, còn engine báo sự kiện chạm (physics3d_co...
Definition njin_physics3d.h:46
Định danh của một body vật lý 3D, tạo bởi body3d_create().
Definition _types.h:160
Component: entity đi theo một body vật lý.
Definition njin_physics3d.h:1199
body3d_handle handle
Body từ body3d_create().
Definition njin_physics3d.h:1200
Một xương ở một tư thế: vị trí và ba trục của nó trong không gian của model (trước transform của lần ...
Definition njin_3d.h:771
Mô tả một nhân vật cho character3d_create(): hình viên nang đứng thẳng, đi trên sàn,...
Definition njin_physics3d.h:163
vec3 position
Vị trí chân (đáy viên nang).
Definition njin_physics3d.h:164
f32 max_slope
Dốc nhất còn đứng được, độ.
Definition njin_physics3d.h:167
f32 mass
Khối lượng, kg: sức nặng đè lên body động mà nhân vật đứng lên (bập bênh nghiêng, ván nằm trên sàn vẫ...
Definition njin_physics3d.h:172
bool push
Hai nhân vật cùng bật push không chặn cứng nhau: sau mỗi bước, cặp nào chồng lên nhau theo phương nga...
Definition njin_physics3d.h:178
f32 radius
Bán kính viên nang.
Definition njin_physics3d.h:165
f32 height
Chiều cao cả viên nang.
Definition njin_physics3d.h:166
f32 step_height
Bậc cao nhất tự bước lên được.
Definition njin_physics3d.h:168
Định danh của một nhân vật vật lý 3D, tạo bởi character3d_create().
Definition _types.h:167
Component: entity đi theo một nhân vật vật lý.
Definition njin_physics3d.h:1206
character3d_handle handle
Nhân vật từ character3d_create().
Definition njin_physics3d.h:1207
Mô tả một tấm vải cho cloth3d_create(): một lưới chữ nhật columns x rows ô, nằm trong mặt phẳng x–y c...
Definition njin_physics3d.h:820
f32 bend
Độ cứng khi gập, 0 (lụa) .. 1 (bìa cứng).
Definition njin_physics3d.h:828
vec3 position
Tâm tấm vải.
Definition njin_physics3d.h:821
vec3 rotation
Góc xoay, độ, cùng thứ tự với njin::transform3d.
Definition njin_physics3d.h:822
u32 pinned_count
Số phần tử của pinned.
Definition njin_physics3d.h:837
bool walkable
Như njin::softbody3d_desc::walkable: đứng được trên tấm vải nằm ngang.
Definition njin_physics3d.h:840
f32 friction
Ma sát, 0..1.
Definition njin_physics3d.h:830
bool collide_soft
Như njin::softbody3d_desc::collide_soft: hai tấm vải không xuyên qua nhau.
Definition njin_physics3d.h:839
i32 columns
Số ô theo chiều rộng, 1..512.
Definition njin_physics3d.h:824
u64 user
Số của game, đọc lại bằng softbody3d_user().
Definition njin_physics3d.h:838
i32 rows
Số ô theo chiều cao, 1..512.
Definition njin_physics3d.h:825
vec2 size
Chiều rộng (x) và chiều cao (y).
Definition njin_physics3d.h:823
u8 pin_edges
Các cạnh bị ghim (bit njin::cloth3d_edge).
Definition njin_physics3d.h:835
f32 damping
Cản chuyển động: vận tốc giảm theo tỉ lệ này mỗi giây.
Definition njin_physics3d.h:829
f32 mass
Khối lượng cả tấm, kg.
Definition njin_physics3d.h:826
f32 drag
Hệ số cản của không khí, như njin::softbody3d_desc::drag.
Definition njin_physics3d.h:831
const u32 * pinned
Các đỉnh bị ghim thêm (góc trên của lá cờ...).
Definition njin_physics3d.h:836
f32 thickness
Độ dày, đơn vị thế giới: các đỉnh giữ cách mặt vật khác chừng này, để vải không chìm vào bàn khi vẽ.
Definition njin_physics3d.h:834
f32 stiffness
Độ cứng của sợi vải, 0 (dãn) .. 1 (không dãn).
Definition njin_physics3d.h:827
Một sự kiện chạm của bước mô phỏng vừa rồi: hai body, hoặc một body và một nhân vật,...
Definition njin_physics3d.h:431
body3d_handle a
Body thứ nhất.
Definition njin_physics3d.h:432
bool sensor
Một trong hai là sensor (njin::body3d_desc::sensor).
Definition njin_physics3d.h:436
vec3 point
Điểm chạm, khi began.
Definition njin_physics3d.h:437
character3d_handle character
Nhân vật chạm a, khi b không hợp lệ.
Definition njin_physics3d.h:434
body3d_handle b
Body thứ hai; không hợp lệ khi bên kia là nhân vật.
Definition njin_physics3d.h:433
bool began
true: bắt đầu chạm. false: thôi chạm.
Definition njin_physics3d.h:435
vec3 normal
Pháp tuyến chạm, khi began: từ a sang b (hoặc sang nhân vật).
Definition njin_physics3d.h:439
Định danh của một khối lồi dùng để dò va chạm, tạo bởi physics3d_hull_create().
Definition _types.h:188
Mô tả một khớp nối cho joint3d_create().
Definition njin_physics3d.h:488
f32 spring
Lò xo của bản lề, khớp trượt và njin::joint3d_distance: tần số dao động, Hz (độ cứng không phụ thuộc ...
Definition njin_physics3d.h:512
vec3 anchor
Điểm nối.
Definition njin_physics3d.h:493
f32 ratio
Tỉ số.
Definition njin_physics3d.h:527
f32 min
Giới hạn: góc, độ (bản lề); quãng trượt, đơn vị thế giới, 0 là vị trí lúc tạo (khớp trượt); khoảng cá...
Definition njin_physics3d.h:503
f32 max
Xem min.
Definition njin_physics3d.h:504
vec3 axis
Trục xoay (bản lề) hoặc trục trượt (khớp trượt).
Definition njin_physics3d.h:495
vec3 pulley_b
Điểm cố định dây bên b vắt qua (njin::joint3d_pulley).
Definition njin_physics3d.h:529
vec3 anchor_b
Điểm nối ở phía b, chỉ cho njin::joint3d_distance.
Definition njin_physics3d.h:494
f32 damping
Giảm chấn của lò xo, 0 (nảy mãi) .. 1 (về chỗ không nảy).
Definition njin_physics3d.h:514
body3d_handle a
Body thứ nhất.
Definition njin_physics3d.h:490
f32 motor_force
Mô-tơ của bản lề và khớp trượt: lực tối đa (bản lề: mô-men, N·m) để giữ tốc độ đặt bằng joint3d_set_m...
Definition njin_physics3d.h:507
joint3d_handle joint_b
Bản lề thứ hai (njin::joint3d_gear) hoặc khớp trượt của thanh răng (njin::joint3d_rack); body a của n...
Definition njin_physics3d.h:520
vec3 pulley_a
Điểm cố định dây bên a vắt qua (njin::joint3d_pulley).
Definition njin_physics3d.h:528
joint3d_kind kind
Loại khớp.
Definition njin_physics3d.h:489
body3d_handle b
Body thứ hai. Không hợp lệ là nối a vào một điểm cố định của thế giới.
Definition njin_physics3d.h:492
joint3d_handle joint_a
Bản lề thứ nhất của njin::joint3d_gear và njin::joint3d_rack (body a của nó là bánh răng).
Definition njin_physics3d.h:517
Định danh của một khớp nối vật lý 3D, tạo bởi joint3d_create().
Definition _types.h:174
Một lưới tam giác do game tự dựng, cho model_create(): địa hình sinh theo seed, hình ghép lúc chạy.
Definition njin_3d.h:381
Định danh của một model 3D, tạo bởi model_load().
Definition _types.h:153
Tư thế của một model có xương khi vẽ: animation nào, ở giây thứ mấy, và (tùy chọn) trộn với animation...
Definition njin_3d.h:620
Mô tả một xe máy cho motorcycle3d_create(): thân là một body động hình hộp size (hoặc bao lồi của mod...
Definition njin_physics3d.h:1087
vec3 position
Tâm thân xe.
Definition njin_physics3d.h:1088
f32 max_rpm
Vòng tua lớn nhất. Hộp số tự động, sáu số.
Definition njin_physics3d.h:1103
f32 mass
Khối lượng cả xe và người lái, kg.
Definition njin_physics3d.h:1093
vec3 center_of_mass
Trọng tâm so với tâm thân xe.
Definition njin_physics3d.h:1094
f32 max_lean
Góc nghiêng tối đa khi vào cua, độ.
Definition njin_physics3d.h:1101
f32 wheel_radius
Bán kính bánh.
Definition njin_physics3d.h:1096
f32 wheel_width
Bề rộng bánh.
Definition njin_physics3d.h:1097
f32 brake_torque
Lực phanh bánh trước, N·m; bánh sau một nửa.
Definition njin_physics3d.h:1104
vec3 size
Hộp của thân xe: rộng (x), cao (y), dài (z).
Definition njin_physics3d.h:1090
u64 user
body3d_user() của thân xe.
Definition njin_physics3d.h:1106
f32 wheelbase
Khoảng cách giữa hai bánh, đơn vị thế giới.
Definition njin_physics3d.h:1095
f32 friction
Ma sát của thân xe (khi đổ, khi quệt tường), 0..1.
Definition njin_physics3d.h:1105
f32 max_steer
Góc lái tối đa, độ. Engine tự giảm khi xe chạy nhanh để xe không đổ.
Definition njin_physics3d.h:1100
f32 caster
Góc nghiêng của phuộc trước, độ.
Definition njin_physics3d.h:1099
vec3 scale
Tỉ lệ của model.
Definition njin_physics3d.h:1092
f32 suspension
Hành trình giảm xóc.
Definition njin_physics3d.h:1098
model_handle model
Lấy thân xe từ bao lồi của model này thay cho size.
Definition njin_physics3d.h:1091
vec3 rotation
Góc xoay, độ, cùng thứ tự với njin::transform3d.
Definition njin_physics3d.h:1089
f32 engine_torque
Mô-men xoắn lớn nhất của động cơ, N·m.
Definition njin_physics3d.h:1102
Một phần của ragdoll: một xương của model thành một viên nang vật lý dọc theo trục y của xương (hướng...
Definition njin_physics3d.h:613
f32 bend_max
Xem bend_min.
Definition njin_physics3d.h:630
f32 bend_min
Bản lề thay cho khớp cầu (gối, khuỷu tay): xoay quanh trục x của xương, góc trong [bend_min,...
Definition njin_physics3d.h:629
f32 swing
Khớp cầu nối với phần cha: góc lệch tối đa của trục xương, độ.
Definition njin_physics3d.h:623
const char * name
Tên xương (model_bone_find()).
Definition njin_physics3d.h:614
f32 length
Chiều dài từ gốc xương.
Definition njin_physics3d.h:621
f32 twist
Góc vặn tối đa quanh trục xương, độ, cả hai chiều.
Definition njin_physics3d.h:624
f32 radius
Bán kính viên nang.
Definition njin_physics3d.h:617
Mô tả một ragdoll cho ragdoll3d_create().
Definition njin_physics3d.h:634
vec3 velocity
Vận tốc ban đầu của mọi phần.
Definition njin_physics3d.h:646
f32 friction
Ma sát, 0..1.
Definition njin_physics3d.h:645
model_pose pose
Tư thế lúc bắt đầu, thường là tư thế vừa vẽ.
Definition njin_physics3d.h:638
f32 mass
Khối lượng cả người, kg, chia cho các phần theo thể tích.
Definition njin_physics3d.h:644
model_handle model
Model có xương (model_load()).
Definition njin_physics3d.h:635
transform3d transform
Chỗ model đang được vẽ, như draw_model_anim(). Tỉ lệ phải đều ba trục.
Definition njin_physics3d.h:637
u32 bone_count
Số phần trong bones.
Definition njin_physics3d.h:643
const ragdoll3d_bone * bones
Các phần, mỗi phần một xương khác nhau.
Definition njin_physics3d.h:642
u64 user
body3d_user() của mọi phần.
Definition njin_physics3d.h:647
Định danh của một ragdoll, tạo bởi ragdoll3d_create().
Definition _types.h:181
Kết quả khi tia chạm một vật.
Definition njin_3d.h:847
Một tia trong thế giới 3D, dùng để chọn vật bằng chuột, bắn đạn, kiểm tra tầm nhìn.
Definition njin_3d.h:841
Màu gồm đỏ, xanh lá, xanh dương và alpha.
Definition _types.h:64
Một hình cơ bản vẽ bằng SDF (hàm khoảng cách có dấu), dùng với draw_shape3d().
Definition njin_3d.h:263
Chỗ một tia hay một khối đẩy trúng vật mềm, cho các bản physics3d_raycast(), physics3d_box_cast() và ...
Definition njin_physics3d.h:314
i32 vertex
Đỉnh của tam giác đó gần chỗ trúng nhất: để ghim, kéo, hay đẩy chỗ bị bắn.
Definition njin_physics3d.h:317
softbody3d_handle soft
Vật mềm bị trúng; không hợp lệ nếu trúng body hay không trúng gì.
Definition njin_physics3d.h:315
i32 face
Tam giác bị trúng: tam giác thứ face của softbody3d_indices() (chỉ số 3 * face).
Definition njin_physics3d.h:316
Mô tả một vật mềm cho softbody3d_create().
Definition njin_physics3d.h:738
softbody3d_kind kind
Hình.
Definition njin_physics3d.h:739
f32 bend
Độ cứng khi uốn, 0 (gập tự do) .. 1 (giữ dáng cong lúc tạo). Hộp không dùng.
Definition njin_physics3d.h:759
vec3 position
Tâm.
Definition njin_physics3d.h:740
u64 user
Số của game, đọc lại bằng softbody3d_user().
Definition njin_physics3d.h:775
f32 mass
Khối lượng cả vật, kg, chia đều cho các đỉnh.
Definition njin_physics3d.h:755
vec3 scale
Tỉ lệ của model.
Definition njin_physics3d.h:754
f32 drag
Hệ số cản của không khí trên mặt của vật (gió, softbody3d_set_wind()).
Definition njin_physics3d.h:770
f32 friction
Ma sát, 0..1.
Definition njin_physics3d.h:765
bool collide_soft
Va chạm với các vật mềm khác cũng bật cờ này: hai tấm vải chồng lên nhau, bóng rơi lên nệm.
Definition njin_physics3d.h:780
bool walkable
Nhân vật đứng được trên mặt trên của nó (nệm, bạt nhún, khối thạch), lún xuống theo sức nặng của nhân...
Definition njin_physics3d.h:785
f32 restitution
Độ nảy, 0..1.
Definition njin_physics3d.h:766
i32 detail
Độ mịn.
Definition njin_physics3d.h:747
f32 stiffness
Độ cứng của các cạnh, 0 (dãn như cao su non) .. 1 (không dãn).
Definition njin_physics3d.h:757
model_handle model
Lấy lưới từ model này (model_load()) cho softbody3d_mesh, thay cho mesh, đặt như draw_model() vẽ nó v...
Definition njin_physics3d.h:753
vec3 rotation
Góc xoay, độ, cùng thứ tự với njin::transform3d.
Definition njin_physics3d.h:741
vec3 size
Kích thước của hộp theo x, y, z.
Definition njin_physics3d.h:742
f32 radius
Bán kính của mặt cầu.
Definition njin_physics3d.h:743
mesh3d_data mesh
Lưới cho softbody3d_mesh, trong hệ trục riêng của vật (đặt ở position, xoay rotation).
Definition njin_physics3d.h:750
f32 pressure
Áp suất bên trong khi vật ở đúng hình lúc tạo, Pa (N/m²).
Definition njin_physics3d.h:764
const u32 * pinned
Các đỉnh bị ghim: đứng yên, hoặc theo softbody3d_move_pinned().
Definition njin_physics3d.h:773
u32 pinned_count
Số phần tử của pinned.
Definition njin_physics3d.h:774
f32 damping
Cản chuyển động: vận tốc giảm theo tỉ lệ này mỗi giây.
Definition njin_physics3d.h:767
Định danh của một vật mềm (vải, bóng, khối cao su), tạo bởi softbody3d_create() hoặc cloth3d_create()...
Definition _types.h:196
Mô tả một xe bánh xích (xe tăng, máy xúc) cho tracked3d_create(): thân là một body động hình hộp size...
Definition njin_physics3d.h:1129
vec3 scale
Tỉ lệ của model.
Definition njin_physics3d.h:1134
vec3 rotation
Góc xoay, độ, cùng thứ tự với njin::transform3d.
Definition njin_physics3d.h:1131
f32 max_rpm
Vòng tua lớn nhất. Hộp số tự động.
Definition njin_physics3d.h:1142
f32 engine_torque
Mô-men xoắn lớn nhất của động cơ, N·m.
Definition njin_physics3d.h:1141
vec3 position
Tâm thân xe.
Definition njin_physics3d.h:1130
f32 brake_torque
Lực phanh mỗi dải xích, N·m.
Definition njin_physics3d.h:1143
vec3 size
Hộp của thân xe: rộng (x), cao (y), dài (z).
Definition njin_physics3d.h:1132
model_handle model
Lấy thân xe từ bao lồi của model này thay cho size.
Definition njin_physics3d.h:1133
f32 suspension
Hành trình giảm xóc của các bánh giữa.
Definition njin_physics3d.h:1140
vec3 center_of_mass
Trọng tâm so với tâm thân xe.
Definition njin_physics3d.h:1136
f32 mass
Khối lượng, kg.
Definition njin_physics3d.h:1135
u64 user
body3d_user() của thân xe.
Definition njin_physics3d.h:1145
f32 wheel_radius
Bán kính bánh.
Definition njin_physics3d.h:1138
f32 friction
Ma sát của thân xe, 0..1.
Definition njin_physics3d.h:1144
i32 wheels_per_side
Số bánh mỗi bên, 3..16: hai bánh đầu cuối nâng cao, các bánh giữa đỡ xe.
Definition njin_physics3d.h:1137
f32 wheel_width
Bề rộng bánh (dải xích).
Definition njin_physics3d.h:1139
Vị trí, hướng và tỉ lệ của một vật 3D.
Definition njin_3d.h:504
Vị trí, góc xoay và tỉ lệ của một entity trong thế giới.
Definition _comps.h:14
Vector 2 chiều. Dùng cho vị trí, kích thước, độ dời.
Definition _types.h:39
Vector 3 chiều.
Definition _types.h:47
Mô tả một xe có bánh cho vehicle3d_create().
Definition njin_physics3d.h:979
vec3 center_of_mass
Trọng tâm so với tâm thân xe. Thấp hơn tâm hộp thì xe khó lật khi cua gấp.
Definition njin_physics3d.h:987
f32 engine_torque
Mô-men xoắn lớn nhất của động cơ, N·m.
Definition njin_physics3d.h:1000
f32 suspension
Hành trình giảm xóc, đơn vị thế giới.
Definition njin_physics3d.h:994
u64 user
body3d_user() của thân xe.
Definition njin_physics3d.h:1005
f32 wheel_radius
Bán kính của bốn bánh mặc định.
Definition njin_physics3d.h:992
model_handle model
Lấy thân xe từ bao lồi của model này thay cho size.
Definition njin_physics3d.h:983
f32 max_steer
Góc lái tối đa của bánh lái, độ.
Definition njin_physics3d.h:997
f32 handbrake_torque
Lực phanh tay mỗi bánh, N·m.
Definition njin_physics3d.h:1003
f32 max_rpm
Vòng tua lớn nhất. Hộp số tự động.
Definition njin_physics3d.h:1001
const vehicle3d_wheel * wheels
Các bánh xe.
Definition njin_physics3d.h:990
vec3 size
Hộp của thân xe: rộng (x), cao (y), dài (z).
Definition njin_physics3d.h:982
vec3 rotation
Góc xoay, độ, cùng thứ tự với njin::transform3d.
Definition njin_physics3d.h:981
u32 wheel_count
Số phần tử của wheels.
Definition njin_physics3d.h:991
f32 suspension_damping
Giảm chấn, 0 (nảy mãi) .. 1 (không nảy).
Definition njin_physics3d.h:996
f32 mass
Khối lượng, kg.
Definition njin_physics3d.h:985
vec3 scale
Tỉ lệ của model.
Definition njin_physics3d.h:984
f32 brake_torque
Lực phanh mỗi bánh, N·m.
Definition njin_physics3d.h:1002
f32 wheel_width
Bề rộng của bốn bánh mặc định.
Definition njin_physics3d.h:993
f32 friction
Ma sát của thân xe (khi lật, khi quệt tường), 0..1.
Definition njin_physics3d.h:1004
vec3 position
Tâm thân xe.
Definition njin_physics3d.h:980
f32 suspension_frequency
Độ cứng của giảm xóc, dao động mỗi giây: 1 êm, 3 thể thao.
Definition njin_physics3d.h:995
Định danh của một xe có bánh, tạo bởi vehicle3d_create().
Definition _types.h:222
Một bánh xe của njin::vehicle3d_desc.
Definition njin_physics3d.h:965
f32 width
Bề rộng bánh.
Definition njin_physics3d.h:970
bool handbrake
Phanh tay khóa bánh này (bánh sau).
Definition njin_physics3d.h:973
bool steer
Bánh lái (bánh trước).
Definition njin_physics3d.h:971
vec3 position
Tâm bánh khi giảm xóc duỗi hết (xe nhấc khỏi mặt đất), trong hệ trục của thân xe: x sang trái,...
Definition njin_physics3d.h:968
f32 radius
Bán kính bánh.
Definition njin_physics3d.h:969
bool drive
Động cơ kéo bánh này.
Definition njin_physics3d.h:972