Chủ Nhật, 19 tháng 2, 2023
Thứ Hai, 21 tháng 11, 2022
Hướng dẫn UNITY cho người mới
Hướng dẫn unity
--------------------------------------------------------------
set up hinge joint cho cửa ra vào tự động mở khi có người
thiết lập tại cubic tạo cánh cửa (chứ không phải là đối tượng cha của nó)
thêm thuộc tính Rigidbody defaul là check gravity,
add component Hinge joint
chuyển pivot của cubic cánh cửa sang bên phần trục xoay cánh cửa
sau đó tạo đối tượng cha là door (tên tùy đặt)
Hinge Joint component reference
The Hinge Joint groups together two Rigidbodies
, constraining them to move like they are connected by a hinge. It is perfect for doors, but can also be used to model chains, pendulums, etc.

Properties
Details
A single Hinge Joint should be applied to a GameObject
. The hinge will rotate at the point specified by the Anchor property, moving around the specified Axis property. You do not need to assign a GameObject to the joint’s Connected Body property. You should only assign a GameObject to the Connected Body property if you want the joint’s Transform to be dependent on the attached object’s Transform.
Think about how the hinge of a door works. The Axis in this case is up, positive along the Y axis. The Anchor is placed somewhere at the intersection between door and wall. You would not need to assign the wall to the Connected Body, because the joint will be connected to the world by default.
Now think about a doggy door hinge. The doggy door’s Axis would be sideways, positive along the relative X axis. The main door should be assigned as the Connected Body, so the doggy door’s hinge is dependent on the main door’s Rigidbody.
Chains
Multiple Hinge Joints can also be strung together to create a chain. Add a joint to each link in the chain, and attach the next link as the Connected Body.
Hints
- You do not need to assign a Connected Body to your joint for it to work.
- Use Break Force in order to make dynamic damage systems. You can use this to allow the player to damage the environment (for example, break a door off its hinges by blasting it with a rocket launcher or running into it with a car).
- The Spring, Motor, and Limits properties allow you to fine-tune your joint’s behaviors.
- Use of Spring, Motor are intended to be mutually exclusive. Using both at the same time leads to unpredictable results.
turn light on or off in unity
How to Animate a Character from Mixamo in Unity - Full Walkthrough
simple car controller in unity
để cài đặt 2D animation cho unity ta vào Unity vào development tool
dowload unity hub. reooif cài đặt Animation 2D 2020,
vào menu Windows -> Packed manager-> tab All Packed -> chọn các
2D IK, 2D Pixel Perfect, 2D PSDImporter
quá trình cài rất nhanh
mở Sprite Editor nơi chứa các ảnh của các bộ phận rời nhau
bone Visualbility :
Torso Depth 6
Jacket_Right 7
Jacket_Left 2
Shoulder_Right 9
Arm_Right 8
Hand_Right 9
ShoulderLeft 1
Arm_Left 0
Hand_Left 1
Chest 3
Hips 7
Tail 1
Head 4
Lower 0
Thigh_Right(đùi phải) 8
Leg_Right 7
Food_Right 8
Thigh_Left(đùi trái) 4
Leg_Left 3
Food_Left 4
video tham khảo tại đây
+ Chuyển sang tab Rivert bên trái trình soạn thảo khi xem xương gắn đúng phân cấp rồi ấn vao tab Auto Geometry .
+ ấn vào Button Generated For Selected cuối cùng góc bên phải dưới , mọi thứ xem có đúng không , có thể hiệu chỉnh các điểm ảnh 1 chút tại đây , xong ròi thì ấn Tab Apply phần trên cùng phía phải của cửa sổ Sprite Editor
Ta kéo hình chứa các bộ phận của con cáo vào Scene lưu ý ở dưới Assets có thể có nhiều hình các bộ phận của con cáo rồi nhau ở từng các sprite khác nhau nhưng sprite chứa các bộ phận con cáo được kéo vào ở đây được đặt chung trên 1 sprite (có nghĩa hình được ké vào chỉ gồm 1 ảnh , trên ảnh đó có các ảnh nhỏ
ta có sprite mode : Single
pixel per unit : 100 sửa thành 300 => Apply
Đang chọn FoxSpriteSheet -> Add Component ->Sprite Skin
Nhấn Button đầu tiên Creat Bone
Tab Gizmos Đang được chọn ta có thể kiểm tra tác dộng của xương đến phần bộ phận cơ thể con cáo
trên Scene bây giờ gồm các đối tượng sau : các đối tượng dưới nằm trong đối tương FoxSpriteSheet
FoxSpriteSheet
Torso
ShouldLeft
Chest
Hips
Head
Lower
Dùng sẵn nhân vật Third Player Controler để di chuyển trong scene và sau đó ta có thể thay bằng nhân vật khác nếu muốn
Đóng cửa và mở cửa trong unity
