Multiple Demo Changes
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
this.on_init = function()
|
||||
this.speed = 0.01
|
||||
this.speed = 0.1
|
||||
this.angles = Vec3:new()
|
||||
this.mouse_sens = 0.01
|
||||
end
|
||||
@@ -33,12 +33,5 @@ this.on_update = function()
|
||||
pos = pos - helper.right * this.speed
|
||||
end
|
||||
|
||||
if Input.getMouseButtonJustPressed(0) then
|
||||
hit = rayCast(this.worldPosition, helper.forward, 300)
|
||||
if(hit.hasHit) then
|
||||
hit.object.position = hit.object.position + Vec3:new(0, 0, -15)
|
||||
end
|
||||
end
|
||||
|
||||
this.position = pos
|
||||
end
|
||||
|
||||
@@ -3,9 +3,20 @@ this.on_init = function()
|
||||
this.mouse_sens = 0.01
|
||||
end
|
||||
|
||||
function clamp(min, max, val)
|
||||
if val < min then
|
||||
return min
|
||||
elseif val > max then
|
||||
return max
|
||||
else
|
||||
return val
|
||||
end
|
||||
end
|
||||
|
||||
this.on_update = function()
|
||||
local deltaMouseMovement = Input.getDeltaMousePos()
|
||||
this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens
|
||||
this.angles.x = clamp(-1.57, 1.57, this.angles.x - deltaMouseMovement.y * this.mouse_sens)
|
||||
print(this.angles.x)
|
||||
this.eulerAngles = this.angles
|
||||
|
||||
if Input.getKeyJustPressed(Input.KeyCode.O) then
|
||||
|
||||
Reference in New Issue
Block a user