PayPal-VR/assets/script/paypal_payment.gd

45 lines
1.4 KiB
GDScript

extends Node3D
@onready var btn_paynow = $section1/btn_paynow
@onready var lbl_paid = $section1/lbl_paid
@onready var ray_cast_3d = $xro/saber_right/Node3D/RayCast3D
@onready var pp_btn_cln = $section1/btn_paynow/btn
@onready var vr_view = $VR_VIEW
@onready var camera_3d = $Camera3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass
#await get_tree().create_timer(2).timeout
#get_viewport().use_xr = true
#var r = get_node("VR_VIEW/xro/saber_right")
#r.button_pressed.connect(triggerMonitor)
# For the controller
func triggerMonitor(argv):
if argv == "trigger_click":
if ray_cast_3d.is_colliding() == true:
$HTTPRequest.request_completed.connect(_on_request_completed)
$HTTPRequest.request("https://marstr.online/paypal/vr/vr_payment.php?amount=10.00")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var _mvspeed = 0.25
if Input.is_action_pressed("move_forward"):
camera_3d.transform.origin.z -= _mvspeed
vr_view.transform.origin.z -= _mvspeed
if Input.is_action_pressed("move_left"):
camera_3d.rotation_degrees.y += _mvspeed
vr_view.rotation_degrees.y += _mvspeed
func _on_request_completed(result, response_code, headers, body):
var response = body.get_string_from_utf8()
if response == "SUCCESS":
btn_paynow.visible = false
lbl_paid.visible = true