Cross
Name
Type
Description
Type
Description
-- entity.lua
local function init(self)
self.Physics = true
local box_shape = api.physics.NewBoxShape(1, 1, 1)
local box = api.physics.NewBody(box_shape, 1)
self.Body = box
end
local function update(self, dt)
local vector_x = api.physics.NewVector(1,0,0)
local vector_y = api.physics.NewVector(0,1,0)
local vector_z = vector_x:Cross(vector_y)
print("The Z axis", vector_z, "is perpendicular to the X and Y axes.")
end
-- Turn on physics calculations for this entity.
-- Create a box shape and a body. Assign it to the entity.
-- Create a vector for the X and Y axes directions.
-- Generate the direction of the Z axis using the cross product of the X and Y axes.
-- Prints:
-- The Z axis &{0 0 30} is perpendicular to the X and Y axes.
-- ...Last updated