-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer3D(old).gd
34 lines (26 loc) · 966 Bytes
/
Player3D(old).gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extends KinematicBody
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var Sensitivity = Vector3(1,1,1)
var console
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
console = JavaScript.get_interface("console")
#JavaScript.eval("alert('Calling JavaScript per GDScript!');")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
#console.log("hello testing 2")
var faceX = JavaScript.eval("centerX")
var faceY = JavaScript.eval("centerY")
var faceZ = JavaScript.eval("centerZ")
faceZ = faceZ- 20
#print(faceX) # prints '3.0'
var lerpPos = .8
var newPos = Vector3(-faceX,-faceY,faceZ)*Sensitivity
translation = translation*(1-lerpPos) + newPos*lerpPos
#position.x = faceX*-100 + get_viewport_rect().size.x/2
#position.y = faceY*100 + get_viewport_rect().size.y/2
#console.log("hello testing 4")