API Docs for: 0.5.5
Show:

kick.scene.PickResult Class

Result of Camera.pickPoint.

Constructor

kick.scene.PickResult

(
  • pickingRenderTarget
  • gameObject
  • x
  • y
  • engineUniforms
  • camera
)

Parameters:

Example:

 function SomeComponent() {
      var engine = kick.core.Engine.instance,
         mouseInput = engine.mouseInput,
         camera;
      this.activated = function () {
         camera = engine.activeScene.findComponentsOfType(kick.scene.Camera)[0];
      };

      this.update = function () {
         var objectPicked = function (pickResult) {
               console.log("UV", pickResult.uv, "Normal", pickResult.normal, "distance",
                         pickResult.distance, "point", pickResult.point);
           };
           if (mouseInput.isButtonUp(0)) {
               camera.pickPoint(objectPicked, mouseInput.mousePosition[0], mouseInput.mousePosition[1]);
           }
      };
  };

Item Index

Methods

renderObjectWithShader

(
  • shader
)
private

Parameters:

Returns:

kick.math.Vec4

Properties

distance

Number

The distance of the pick point to the camera

gameObject

kick.scene.GameObject

Reference to the found gameObject

normal

kick.math.Vec3

The normal (in object coordinates) at the pick point

point

kick.math.Vec3

The 3D point in world coordinates of the selected point

uv

kick.math.Vec2

The uv of the pick point

x

Number

The x value of the pick

y

Number

The y value of the pick