S&box Wiki
Home
/
Edit Collisions, Physics & Surface Types
View
Edit
History
No Category
Developer Overview
The Project System
Publishing To Asset Party
Getting Started With Hammer
Mapping Basics
Mapping Entities
Advanced Mapping Techniques
Getting Started with Modeldoc
Animgraph & Animation
Physics
Modeldoc Nodes
Advanced Modelling
UI Basics
Styles & Stylesheets
Razor Templates
Game Menus
Materials
Built In Shaders
Shaders
Shader Reference
Sounds & Audio
Particles
Getting Started
Making Games
Input
Networking
Physics
Rendering
Editor & Tools
VR
Misc
Playing Guides
Console Commands & Variables
Dedicated Server
Log in to edit
Collisions, Physics & Surface Types
<cat>Model.Physics</cat> <title>Collisions, Physics & Surface Types</title> # PhysicsHullFromRender Physics hull from render basically generates a hull mesh for your model from the geometry of the rendered mesh. It usually isn't the best but it is fairly okay for quickly testing things. To add this to your model, simply look for PhysicsHullFromRender on the type browser and simply add it. ![PhysicsHullFromRender](https://i.imgur.com/ARJRV1t.png) If your model contains bones, it will ask you to pick the bone to generate the hull mesh for. For jointed objects note that you should refrain from using automatically generated phys models and go for physics shaped objects like capsules, spheres and boxes. If it is a biped ragdoll note that you can go for either creating a biped ragdoll or creating just ragdoll parts individually. # PhysicsHullFile Another way to add physics to your model is using a prebuilt physics model which you made yourself outside of ModelDoc. This is usually the preferred way to go for porting old assets since you can re-use your old physmodel. To add something like that simply add the following option: ![PhysicsHullFile](https://i.imgur.com/GQrUh1Y.png) This option is going to prompt you to load the model file which you'd like to use as a physics model for your model, once it's added simply compile it and toy around with your model which now has some nice physics. # PhysicsMeshFile <warning>Although this does work with concave meshes THIS TYPE IS NOT FOR PROPS AND ITEMS ingame, it has no simulated physics only collisions, meaning it will be static and unmoveable. Only use it for things like terrain which needs only collisions. For props with more complex collisions or "concave" type collision please navigate below to [Complex Collision Shape](https://wiki.facepunch.com/sbox/PhysicsHullFromRender#complexcollisionshape)</warning> So this is only used in special cases, since this type physics file type is only used for collisions, meaning it will not be able to be moved once its created and it will not fall or react to gravity and so on, think of it like the collisions when you make a map in hammer. It works exactly like that. so in a case unless you making a gamemode which uses custom terrain which is created and loaded on the fly via code or something, this will not be a common one you will use. ![PhysicsMeshFile](https://i.imgur.com/ZtAcaUL.png) # Complex Collision Shape Let's say you wanted a more complex physics shape rather than a shrink wrap, then you will have to use multiple PhysicsHullFiles to build the complex shape. For example, you want to be able to stand inside of this "box": ![example model](https://i.imgur.com/OBL0kyb.png) Then we need to split the collision into a bunch of individual convex meshes. Here is an example of what it would look like: ![multiple collision meshes](https://i.imgur.com/sJLwj08.gif) At this point you have a couple of options for importing these convex meshes: * You can save them all into their own model files and proceed to add PhysicsHullFile for every part of the mesh. You will now have a PhysicsShapeList with multiple PhysicsHullFiles within it. ![example of physicsshapelist](https://i.imgur.com/gMjfl4w.png) You can click through them to check individually or click the PhysicsShapeList to see the final collision model. ![final result](https://i.imgur.com/3J3Vgbc.gif) Now in-game you can get inside of this box, unlike the ones PhysicsHullFromRender makes. Of course, it will also let the model have gravity and collisions too. * Alternatively, you can join all of the individual convex meshes into a model file and then add it as a single PhysicsHullFile with the "Hull Per Element" import mode. This is akin to the traditional way of defining collision models in Source with just a single file for your physics model. ![setting "hull per element"](https://i.imgur.com/8yKFWpi.png) The benefits of doing this is that you can keep the amount of PhysicsHullFiles to a minimum and also keep your directory tidy, but the drawback is that you will need to decide on a single parent bone for your entire assortment of joined convex meshes. Surface Property and Optimization Algorithm, among these grouped convex meshes, will also be shared, and so it is important that you consider the applications of your collision model and group your hull pieces accordingly when using this method. Here is an example of how this can be done for a wind turbine prop with just two groups and a revolute joint in-between: !["hull per element" wind turbine example](https://i.imgur.com/u7Zwl67.gif) # Changing the Surface Property What surface does your object have? Wood? Metal? Surface Properties will determine the sound it produces and, if any, decals and particles coming off when you hit it, as well as the automatcally calculated mass. To change it, go into your PhysicsHull / PhysicsHulls and find this option: ![physicshull surface property](https://i.imgur.com/nTykwaD.png) Set it to whatever you want on your mesh. If you have multiple meshes change their Surface Property too. Done! # Overriding Models Calculated Mass You may see something like this on your PhysicsHulls, don't worry if that isn't right. ![Calculated Mass: way to big or small](https://i.imgur.com/uggIM5R.png) Go to the +Add, search for PhysicsBodyMarkup and add it. ![physicsbodymarkup](https://i.imgur.com/KZvf9rB.png) It will ask you to choose a Target Body, you should just have one if you are making a basic model, so just click the one you see. You will see these options, the only one you gotta care about right now is Mass Override. ![PhysicsBodyMarkup](https://i.imgur.com/mI7UBXO.png) Put an appropriate number in there in KGs and you're good to go. When you only have a Sphere or Pillshaped PhysicsShape your Model will roll forever, to change that edit either Angular Dampening or Linear Dampening to your liking.
S&box Wiki
Development
Developer Overview
6
Editor Overview
General FAQ
System Requirements
The s&box wiki
Troubleshooting
Useful Links
The Project System
4
Adding Assets
Creating a Game Project
Project Settings Window - Games
Project Types
Publishing To Asset Party
2
Uploading assets
Uploading projects
Hammer
Getting Started With Hammer
3
Getting Started With Hammer
Making Your First Map
Mapping Resources
Mapping Basics
7
Cordons
Hotspot Materials
Selection Sets
Standard Mapping Dimensions
Tool Materials
Tools Visualisation Modes
Using Entities That Require a Mesh
Mapping Entities
2
Creating a Door
Light Entities
Advanced Mapping Techniques
8
Collaborating With Prefabs and Git
Instances
Prefabs
Quixel Bridge Plugin
Tilesets
Tilesets-Advanced
Tilesets-Proxies
VIS Optimizations
Models & Animation
Getting Started with Modeldoc
7
Automatic Model Setup
Breakpieces
Creating a Model
Guide to Models
Importing Rust Weapons
LODs
ModelDoc FAQ & best practices
Animgraph & Animation
4
Animations without Animgraph
AnimEvents, AnimGraph Tags, Attachments
Animgraph
Delta Animations
Physics
3
Cloth Physics
Collisions, Physics & Surface Types
Jiggle Bones
Modeldoc Nodes
1
Custom ModelDoc nodes
Advanced Modelling
6
Bodygroups
Citizen
First Person
IKChains and Stride Retargeting
Morphs
Vertex Normals
User Interface
UI Basics
7
Custom Fonts
Embedding Websites
Enabling Pointer Events
Events and Input
Localization
UI Basics
UI with Components
Styles & Stylesheets
1
Video Backgrounds
Razor Templates
4
A Razor Overview
Aliases and SetProperty Attributes
Generic Components
Templates
Game Menus
1
Making a Custom Pause Screen
Materials & Shaders
Materials
5
Guide to Materials
Material Attributes
Material Resources
Texture Settings
Using Dynamic Expressions
Built In Shaders
2
Foliage Shader
Glass Shader
Shaders
4
Compute Shaders
Constant Buffers
Material API
Shading Model
Shader Reference
5
Anatomy of Shader Files
Getting rid of Tex2D macros
Shader Reference
Shader States
Texture Format Cheat-Sheet
Other Assets
Sounds & Audio
3
Guide to Sounds
Sound Events
Soundscapes
Particles
5
Creating animated sprites
Creating your first particle effect
Understanding Particle Editor
Using custom sprites
Using particle systems from C#
Coding
Getting Started
5
Cheat Sheet
Learning Resources
Setting up Rider
Setting up Visual Studio
Setting up Visual Studio Code
Making Games
2
Components
GameObjects
Input
4
Commands
ConVars
Input System
Speech Recognition
Networking
7
Auth Tokens
Http Requests
Lobby System
Networked Types
Networking Basics
RPCs
WebSockets
Physics
5
Collisions
Hitboxes
Joints
Traces
Triggers
Rendering
3
Render Tags
RenderHooks
Scenes
Editor & Tools
7
Creating a Tool
Custom Asset Types
Guide to Widgets
Hammer API
Hammer Gizmos
Hotload Performance
Widget Docking
VR
3
Getting Started
VR Input
VR Overlays
Misc
13
Asset Types
Attributes and Component Properties
Backend API
Cloud Assets in code
Code Accesslist
CPU Performance Profiling
DisplayInfo
FileSystem
Mounting assets at runtime
package/find
Setting Up A Navigation Mesh
Threaded Tasks
TypeLibrary
Playing
Playing Guides
3
Default Keybinds
Proton
s&box on macOS (Experimental)
Console Commands & Variables
1
Launch Arguments
Dedicated Server
1
Dedicated Servers