Двери и другие насущные проблемы

Started by GameRule · one year ago · 3 replies · 829 views

edited one year ago#1
GameRule
Member
JoinedJul 2024 Posts1 Score0
Проведя кое-какое время в хаммере и не имея особое представления в визуальном программировании. У меня возник вопрос по поводу того возможно ли на данный момент доступный инструментарием что-то сделать вроде дверей через Компоненты GameObject (Hinge Joint) или ждать пока Гарри сделает полноценный Entity? 
(Вариант с тем чтобы самому создать кастомный компонент, я рассматривал, но он не по мне.)
edited:
After spending some time in a Hammer and don't having understanding of visual programming, I have a question about whether it is currently possible to create something like doors using the GameObject's Components (Hinge Joint) or should I wait for Garry to create a Entity? (I considered the option of creating a custom component myself, but it's not for me.)

#2
ducc
Banned
JoinedSep 2022 Posts101 Score155
You can make an addon that targets Walker, and within that project you can make a scene that includes FuncDoor components. That scene may then be uploaded as a map.

For more on addons: https://docs.facepunch.com/s/sbox-dev/doc/addon-project-hUCwPwjvj2
Walker FuncDoor source: https://github.com/Facepunch/sbox-walker/blob/main/code/Map/FuncDoor.cs

Now, if all you need is a solid object attached to a hinge that you can push around like a door, then what you can do is:
  1. Add a door model to the scene.
  2. Ensure that the door model GameObject has components for a collider (e.g. BoxCollider ) and Rigidbody
    • If you've made a prop component, break it in to components to verify.
  3. Create a HingeJoint component in a child GameObject under the door
  4. Move the HingeJoint GameObject to the point around which you want the door to rotate.
This assumes that the door is fixed to something unmoving, like the map.

If you need to reference working examples of joints, you can download the Testbed repo and open the .sbproj

Testbed (sbox-scenestaging) repo: https://github.com/Facepunch/sbox-scenestaging/tree/main/

There will be examples of how to use joints under: Scenes/Tests/Physics
delete
Deleted Post
delete
Deleted Post
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.