## Documentation

- Overview
- Website
- Tutorials
- Class Index

## Classes

- _global_
- CL3D
- CL3D.AnimatedMeshSceneNode
- CL3D.Animator
- CL3D.AnimatorAnimateTexture
- CL3D.AnimatorCameraFPS
- CL3D.AnimatorCameraModelViewer
- CL3D.AnimatorCollisionResponse
- CL3D.AnimatorFlyCircle
- CL3D.AnimatorFlyStraight
- CL3D.AnimatorFollowPath
- CL3D.AnimatorOnClick
- CL3D.AnimatorOnProximity
- CL3D.AnimatorRotation
- CL3D.BillboardSceneNode
- CL3D.BoundingBoxTriangleSelector
- CL3D.Box3d
- CL3D.CameraSceneNode
- CL3D.ColorF
- CL3D.CopperCubeVariable
- CL3D.CopperLicht
- CL3D.CubeSceneNode
- CL3D.HotspotSceneNode
- CL3D.Light
- CL3D.LightSceneNode
- CL3D.Line3d
- CL3D.Material
- CL3D.Matrix4
- CL3D.Mesh
- CL3D.MeshBuffer
- CL3D.MeshSceneNode
- CL3D.MeshTriangleSelector
- CL3D.MetaTriangleSelector
- CL3D.Mobile2DInputSceneNode
- CL3D.OctTreeTriangleSelector
- CL3D.Overlay2DSceneNode
- CL3D.ParticleSystemSceneNode
- CL3D.PathSceneNode
- CL3D.Plane3d
- CL3D.Quaternion
- CL3D.Renderer
- CL3D.Scene
- CL3D.SceneNode
- CL3D.SkyBoxSceneNode
- CL3D.SoundSceneNode
- CL3D.TerrainSceneNode
- CL3D.Texture
- CL3D.TextureManager
- CL3D.Triangle3d
- CL3D.TriangleSelector
- CL3D.Vect2d
- CL3D.Vect3d
- CL3D.Vertex3D
- CL3D.WaterSurfaceSceneNode

CopperLicht API Documentation

# Class CL3D.AnimatorCollisionResponse

Scene node animator making CL3D.SceneNodes move using autoamtic collision detection and response
Extends CL3D.Animator.

Class Overview
CL3D.AnimatorCollisionResponse(radius, translation, world, slidingspeed)
Special scene node animator for doing automatic collision detection and response.
This SceneNode animator can be attached to any single SceneNode and will then prevent it from moving through specified collision geometry (e.g. walls and floors of the) world, as well as having it fall under gravity. This animator provides a simple implementation of first person shooter cameras. Attach it to a camera, and the camera will behave as the player control in a first person shooter game: The camera stops and slides at walls, walks up stairs, falls down if there is no floor under it, and so on.
The animator will treat any change in the position of its target scene node as movement, including changing the .Pos attribute, as movement. If you want to teleport the target scene node manually to a location without it being effected by collision geometry, then call reset() after changing the position of the node.
The algorithm used here is a very fast but simple one. Sometimes, it is possible to get stuck in the geometry when moving. To prevent this, always place the object at a position so that the yellow ellipsoid isn't colliding with a wall in the beginning, so that it is not stuck.
If the object gets stuck during movement, then the problem might be the 3d collision mesh: One needs to be a bit careful when modelling the static geometry the object collides against. The geometry should be closed, and there should not be any one sided polygons sticking out anywhere, those are usually the places where one gets stuck.
Also, if the points of vertices which should be together are not exactly at the same point could cause problems. If the used 3d modelling software supports a feature like 'Merge Points' to make neighbour vertices be exactly at the same place, it is recommended to do this, it also usually helps.

Parameters:
{CL3D.Vect3d} radius
  3d vector describing the radius of the scene node as ellipsoid.
{CL3D.Vect3d} translation
  Set translation of the collision ellipsoid. By default, the ellipsoid for collision detection is created around the center of the scene node, which means that the ellipsoid surrounds it completely. If this is not what you want, you may specify a translation for the ellipsoid.
{CL3D.TriangleSelector} world
  Representing the world, the collision geometry, represented by a TriangleSelector.
{Number} slidingspeed
  (optional) A very small value, set to 0.0005 for example. This affects how the ellipsoid is moved when colliding with a wall. Affects movement smoothness and friction. If set to a too big value, this will also may cause the ellipsoid to be stuck.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| animateNode(n, timeMs) Animates the scene node it is attached to and returns true if scene node was modified.
| getType() Returns the type of the animator.
| getWorld() Returns the triangle selector representing the world collision data
| isFalling() Returns if the scene node attached to this animator is currently falling
| reset() Resets the collision system.
| setWorld(selector) Sets the triangle selector representing the world collision data

Methods borrowed from class CL3D.Animator:
  createClone, onKeyDown, onKeyUp, onMouseDown, onMouseMove, onMouseUp, onMouseWheel

Method Detail
animateNode(n, timeMs)
Animates the scene node it is attached to and returns true if scene node was modified.

Parameters:
{CL3D.SceneNode} n
  The Scene node which needs to be animated this frame.
{Integer} timeMs
  The time in milliseconds since the start of the scene.

getType()
Returns the type of the animator. For the AnimatorCollisionResponse, this will return 'collisionresponse'.

getWorld()
Returns the triangle selector representing the world collision data

isFalling()
Returns if the scene node attached to this animator is currently falling

reset()
Resets the collision system. Use this for example to make it possible to set a scene node postition while moving through walls: Simply change the position of the scene node and call reset() to this animator afterwards.

setWorld(selector)
Sets the triangle selector representing the world collision data

Parameters:
selector

© 2011-2018 N.Gebhardt, Ambiera
Documentation generated by JsDoc Toolkit