Matrix:transformPoint
From GiderosMobile
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Available since: Gideros 2013.9
Class: Matrix
Description
Transforms the matrix to an array of points. This function applies the geometric transform represented by the Matrix to a specified array of points.
Matrix:transformPoint()
Example
In this example we reset the player1 matrix by transforming it to the points (0, 0, 0) and we use the result for the lighting
-- game loop
function LevelX:onEnterFrame(e)
local matrix = self.player1.body:getTransform()
local playerx, playery, playerz = self.player1.body:getTransform():getPosition()
-- move player
local force = 12
if self.player1.isleft and not self.player1.isright then
self.player1.body:applyLocalForceAtCenterOfMass(0, 0, force)
elseif self.player1.isright and not self.player1.isleft then
self.player1.body:applyLocalForceAtCenterOfMass(0, 0, -force)
end
-- position the player model along its body
self.player1:setMatrix(matrix)
-- the camera FPS style
self.camera:lookAt(playerx+0.1, playery+24, playerz+4,
playerx, playery, playerz+4
)
-- lighting
local px, py, pz = matrix:transformPoint(0, 0, 0) -- hgy29
Lighting.setLight(px, py+8, pz+1, 0.2)
Lighting.setLightTarget(px, py, pz, 32, 20)
--Compute shadows
Lighting.computeShadows(self.scene)
end
- Matrix
- Matrix.fromSRT
- Matrix.new
- Matrix:duplicate
- Matrix:getAnchorPosition
- Matrix:getElements
- Matrix:getM11
- Matrix:getM12
- Matrix:getM21
- Matrix:getM22
- Matrix:getMatrix
- Matrix:getPosition
- Matrix:getRotationX
- Matrix:getRotationY
- Matrix:getRotationZ
- Matrix:getScale
- Matrix:getScaleX
- Matrix:getScaleY
- Matrix:getScaleZ
- Matrix:getTx
- Matrix:getTy
- Matrix:getTz
- Matrix:getX
- Matrix:getY
- Matrix:getZ
- Matrix:invert
- Matrix:multiply
- Matrix:orthographicProjection
- Matrix:perspectiveProjection
- Matrix:rotate
- Matrix:scale
- Matrix:setAnchorPosition
- Matrix:setElements
- Matrix:setM11
- Matrix:setM12
- Matrix:setM21
- Matrix:setM22
- Matrix:setMatrix
- Matrix:setPosition
- Matrix:setRotationX
- Matrix:setRotationY
- Matrix:setRotationZ
- Matrix:setScale
- Matrix:setScaleX
- Matrix:setScaleY
- Matrix:setScaleZ
- Matrix:setTx
- Matrix:setTy
- Matrix:setTz
- Matrix:setX
- Matrix:setY
- Matrix:setZ
- Matrix:transformPoint
- Matrix:translate