This tutorial will be updated regularly! (5. Feb 2014)
An good overview about possible PHYSIC ENTITYS you can get here:
http://freesdk.crydev.net/display/SDKDOC2/Physics Entities
I recommend, that all assets, setup as RigidBodyEx, should have an closed physical proxy. This is good for performance and prevents issues in physical calculation, based on complex meshes.
In the CryEngine we have the option to setup content in many different ways. Normal assets we want to interact with, we can setup for example as "RigidBodyEx" entity. This node means, that the mesh is physically fully interacting and swimming by the values we setup in its properties.
All shown values in this tutorial are a base for the barrel and its reaction in the water.
To setup a basic CGF or CGA mesh as RigidBodyEx, we need to use the ENTITY -> PHYSICS -> RIGIDBODYEX and place it at the map:
Picture:
When its done, an primitive with basic settings is set to the map. To echange this primitive with our own mesh, please change the modellpath at the location, the red arrow is point to.
Picture:
Based on my uploaded barrel to the FTP, I have used it in this example. Is the modell changed, we need to focus the follow options (from up till down the next picture):
1.) LOD - Ratio: Can be set from 1 till 255. The higher the value, the faster the LODs switch from one state to another (1 = very, very far away and 255 = LODs switch very fast)
2.) Pickable: Is required to pickup the mesh from the ground
3.) CanBreakOthers: Is need when the asset should break other assets (when flying around etc.)
4.) Density: Depend on Cryteks definiton on material densitys, we can here set the value.
IMPORTANT:
DENSITY = Volume / Mass! Density affects the way objects interact with other objects and float in the water (they sink if their density is more than that of the water).
Don't set both: mass AND density. Just set one. Leave the other at -1 (its value will be calculated automatically). Mass = Density * Volume. Mass is the weight of the object (the density of the object multiplied by its volume).
Density is kg / cubic meters. So, density = 1000 would be the weight of water. I find that to be a good baseline: Is your object denser than or lighter than water? Set density accordingly.
Or if you know how much you want its mass to be then just set that. Like if you used the banana cluster as a model? 1-2 kg is probably fine, and you leave density at -1.
Trying to set BOTH of them can have unpredictable results. Might have no bad side effects or it might cause problems. Another possibility is something with flawed geometry that gives the physics engine troubles.
Reference Density Values (in kg/m^3):
Material Density (kg/m3)
Wood 500-700
Ice 900
Water 1000
Rubber 1500
Glass 2600
Iron 7500
Lead 11400
Gold 19300
Info:
Dry static friction reference table:
Material pair μ
Aluminium/aluminium 1.9
Aluminium/steel 0.61
Brick/brick 0.65
Diamond/diamond 0.1
Glass/glass 0.94
Glass/metal 0.5-0.7
Gold/gold 2.5-4.0
Ice/ice 0.1
Rubber/concrete 1.0-4.0
Steel/steel 0.74
Wood/stone 0.4
Wood/wood 0.25-0.5
Stone/stone 0.4-0.7
Picture:
4.) At least we need to setup the buoyancy settings. This values define the reaction inside water. From up till down the next picture (look at the red arrows area).
Water damping: Sets the strength of the damping on an object's movement is soon as it is situated underwater. Most objects can work with 0 damping; if an object has trouble coming to rest, try values like 0.2-0.3. Values of 0.5 and higher appear visually as overdamping. Note that when several objects are in contact, the highest damping is used for the entire group.
Water density: (100..1000) This parameter could be used to specify that the object's physical geometry can leak. For instance, ground vehicles usually have quite large geometry volumes, but they are not waterproof, thus Archimedean force acting on them will be less than submerged_volume 1000 (with 1000 being the actual water density). Decreasing per-object effective water density will allow such objects to sink (as they would in reality) while still having large-volume physical geometry. Important note: if you are changing the default value (1000), it is highly recommended that you also change water_resistance in the same way (a rule of thumb might be to always keep them equal).
Water resistance: (0..2000) Water resistance coefficient. If non-0, precise water resistance is calculated. Otherwise only water_damping (proportional to the submerged volume) is used to uniformly damp the movement. The former is somewhat slower, but not prohibitively, so it is advised to always set the water resistance. Although water resistance is not too visible on a general object, setting it to a suitable value will prevent very light objects from jumping in the water, and water flow will affect things more realistically. Note that water damping is used regardless of whether water resistance is 0, so it is better to set damping to 0 when resistance is turned on.
Picture: