Collider

From DeltaWiki
Revision as of 02:30, 5 May 2023 by Xan (talk | contribs) (Created page with "{{feature|1122|5.1}} The ''collider'' command will add the object to the list of physical objects, which is a requirement for the object to become part of the physical representation. The command defines the shape of the collision bounding box and sets the physics behavior with static or nogravity. A ground plane (excluding object groups used as ground object) and the terrain always will respond to physics as if static was defined. They can be collided with without mov...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Collider
Build

1122

Version

5.1

The collider command will add the object to the list of physical objects, which is a requirement for the object to become part of the physical representation. The command defines the shape of the collision bounding box and sets the physics behavior with static or nogravity.

A ground plane (excluding object groups used as ground object) and the terrain always will respond to physics as if static was defined. They can be collided with without moving and are set a mass of infinity.

All non-collider defined objects will be excluded from any physics behavior. Physical objects will not collide with them nor will they react to applied forces or impulses.

Usage

collider [primitive] [mass=value] [static|nograv] [avvel]
[dampLin=value] [dampAng="a b c"] [name=name] [global]

primitive

Collider primitives represent the shape of a rendered 3D mesh within the physics engine.

  • box is the default, using the object's axis aligned bounding box (AABB). Boxes work for most objects we deal with, for example walls, floors, panels, small poles, etc.
  • sphere collisions are generalized ellipsoids, it can create many different kind of objects by just playing with dimensions of the radius. This is a very flexible primitive shape that uses the dimensions of the AABB for it's radius in all 3 axes. If all 3 radius' are equal, it makes a perfect sphere. If two radius' are equal, it makes an ellipse of revolution.
  • A cone of a given radius and height, which it gets from the AABB. The browser takes care of correct alignment for most common cases. It is aligned with the x axis after creation. The cone height must be greater than or equal to the diameter of the cap. If this is not the case, then the height will be clamped to the diameter.
  • A cylinder of given radius and height, where it uses the AABB for the calculation of height and radius and takes care of correct alignment with the x axis after creation. The ground and top plane of the cylinder must be equal circles and must have the same radius. If the ground and top planes are elipsoids, you are better using a box or sphere primitive instead.
  • capsule is similar to a cylinder, just that it's bottom and top shapes are rounded.
  • A convex hull is the primitive that aims the shape the original geometry the best. Use it with care and only if really needed, as the 3D mesh can be rather complex and thereby it can produce heavy load to your computer. It is useful for getting objects to interact with exterior curved surfaces of the model it is applied to.
  • tree collision is the preferred method for collision with polygonal meshes of arbitrary complexity. The mesh must be made of flat non-intersecting polygons, but they do not explicitly need to be triangles. It is also useful for getting objects to interact with interior curved surfaces of the model it is applied to.

When a TreeCollision is assigned to a body the mass of the body is ignored in all dynamics calculations. This makes the body behave as a static body.

mass

The mass is given as an optional attribute to the collider command. Only positive values are possible. If no mass is specified, the volume of the collider primitive is used to calculate a default mass, which works well for most cases. The mass of an object is important to calculate the impact it has on other bodies when it hits them. A mass of zero makes the collider static and its body is ignored in all dynamics calculations. Other bodies still collide with this body, but this body won't move.

mass=1
mass=100
mass=.1

dampLin

The dampening viscous friction force is added to the external force applied to the body every frame before going to the solver-integrator. This force is proportional to the square of the magnitude of the velocity to the body in the opposite direction of the velocity of the body. An application can set linear damping coefficient to zero when the application takes control of the external forces and torque applied to the body, should the application desire to have absolute control of the forces over that body. However, it is recommended that the linear damping coefficient is set to a non-zero value for the majority of background bodies. This saves the application from having to control these forces and also prevents the integrator from adding very large velocities to a body.

The value for linear damping is clamped to a value between 0.0 and 1.0; the default value is 0.1. There is a non zero implicit attenuation value of 0.0001 assumed by physics engine.

dampLin=0
dampLin=1
dampLin=.3

dampAng

The dampening viscous friction torque is added to the external torque applied to the body every frame before going to the solver-integrator. This torque is proportional to the square of the magnitude of the angular velocity to the body in the opposite direction of the angular velocity of the body. An application can set angular damping coefficients to zero when the to take control of the external forces and torque applied to the body, should the application desire to have absolute control of the forces over that body. However, it is recommended that the angular damping coefficients be set to a non-zero value for the majority of background bodies. This saves the application from needing to control these forces and also prevents the integrator from adding very large velocities to a body.

The values "a b c" for angular damping is clamped to a value between 0.0 and 1.0; the default value is 0.1. There is a non zero implicit attenuation value of 0.0001 assumed by physics engine. The values for a, b, and c are the angular damping coefficients for the principal axis of the physical object.

dampAng="0 0 1"
dampAng="1 1 1"
dampAng=".3 .8 1"

Flags

Flags may be static, nogravity and / or avvel.

  • static will cause the object to react on collisions, but won't move itsself.
  • nogravity, or nograv in short, will cause the object to behave like in outer space.
  • avvel allows an avatar to interact with object on collision, e.g. to kick a ball.

name

The name specifies the name of the object within the same cell the command gets applied to.

global

A command with the Global argument appended will cause the triggered command to be sent to all neighbors in view, if enabled with the world feature settings.

See also

Physics

Object Scripting

Building2.jpg

Triggers: CreateBumpActivateAdoneAtCollideSdoneEnter ZoneExit Zone

Commands: AddforceAddtorqueAlpharefAnimateAstartAstopCameraColliderColltagColorCoronaEnviExamineFrameGroupLightLinkLockMatfxMediaMidiMoveNameNoiseOpacityPictureRotateSayScale SeqShadowShearSignSkewSkyboxSolidSoundTagTeleport / TeleportxTextureTimerURLVelocityVisibleWarpWeb