![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | bgegg |
i try this tutorial for gimbal camera.i want stop x rotation to character overhead(90 degree).
this is not limitation.
https://i.imgur.com/j1wD1k5.mp4
but i not know how to set rotation of limit.
i use clamp in this code.but not work it.
var cam_speed =1
var zoom_speed = 0.01
func _process(delta):
if Input.is_key_pressed(KEY_RIGHT):
rotate_y(cam_speed * delta)
if Input.is_key_pressed(KEY_LEFT):
rotate_y(-cam_speed * delta)
if Input.is_key_pressed(KEY_UP):
get_node("Spatial_inner").rotate_x(clamp(cam_speed * delta,0,90))
and i try this.but this is not work.i use rotation_degree function.
extends Spatial
var cam_speed =1
var zoom_speed = 0.01
func _process(delta):
if Input.is_key_pressed(KEY_RIGHT):
rotate_y(cam_speed * delta)
if Input.is_key_pressed(KEY_LEFT):
rotate_y(-cam_speed * delta)
if Input.is_key_pressed(KEY_UP):
if get_rotation_degrees().x < 90:
get_node("Spatial_inner").rotate_x(cam_speed * delta)
Please tell me the tutorial page or method.