eb27ae4c24
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
26 lines
703 B
Lua
Executable File
26 lines
703 B
Lua
Executable File
-- this.on_collisionenter = function(other)
|
|
-- other.position = other.position + Vec3:new(3.2, 0, 0)
|
|
-- end
|
|
this.on_init = function()
|
|
-- print(this:getChild('Child').position:to_string())
|
|
end
|
|
|
|
this.on_update = function ()
|
|
rb = this:getComponent(Rigidbody)
|
|
if Input.getKeyDown(Input.KeyCode.Space) then
|
|
rb:addForce(Vec3:new(0, 100, 0))
|
|
end
|
|
if Input.getKeyDown(Input.KeyCode.D) then
|
|
rb:addForce(Vec3:new(10, 0, 0))
|
|
end
|
|
if Input.getKeyDown(Input.KeyCode.A) then
|
|
rb:addForce(Vec3:new(-10, 0, 0))
|
|
end
|
|
if Input.getKeyDown(Input.KeyCode.W) then
|
|
rb:addForce(Vec3:new(0, 0, -10))
|
|
end
|
|
if Input.getKeyDown(Input.KeyCode.S) then
|
|
rb:addForce(Vec3:new(0, 0, 10))
|
|
end
|
|
end
|