@TwistedTwigleg thanks for answer me! But I have got error since run into Godot Engine Game. And It throws error:
PS Why do you use scancode? But I am using in Godot 3.1 Alpha
I have tried replace this:
if Input.is_mouse_button_pressed(BUTTON_LEFT) and event.pressed == true:
mode = 1
elif Input.is_mouse_button_pressed(BUTTON_RIGHT) and event.pressed == true:
mode = 2
else:
mode = null
And It looks like hiding mesh cube :( I want "press and move" or "press and rotate" or "press zoom" like Substance Designer's previewer
You're right but - I AM SORRY - I am never supoorting for Facebook, Reddit and Discord because It is bad for me. Sorry I don't want sign up to Facebook, Reddit and Discord because they are very dangerous to me. But Facebook hurts me and Reddit forces me if I am new and I wait longer than 4 months they are bad to me. And Discord made by Unity 3D Team has thrown me from Discord. PLEASE LEAVE BAD CONNECTION! - I wish you have good connection with Twitter, Google+ because I am very dangerous to 3 bad connections. Sorry for bad ways with dangerous websites.
Please respect me! I hate Facebook, Discord and Reddit. I never support for dangerous websites. Sorry for shocking! I want tell you because I am holding and ignoring to dangerous websites. Please make sure to connect to Google+ and Twitter!
PS: Please do not share my threads / posts to Facebook, Reddit or Discord! Thank you!
// EDIT - It works fine but I need release if Mouse Button doesn't press than motions should stay or be busy.
I have resolved:
extends Spatial
var mode = null
const CAMERA_MOVE_SPEED = 0.01;
const CAMERA_ROTATE_SPEED = 0.01;
const CAMERA_ZOOM_SPEED = 0.01;
Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _input(event):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
mode = 1
elif event.button_index == BUTTON_RIGHT and event.pressed:
mode = 2
elif event.button_index == BUTTON_MIDDLE and event.pressed:
mode = 3
elif event is InputEventMouseMotion:
var camera = get_viewport().get_node("Camera")
if (mode == 1):
camera.translate(Vector3(event.relative.x, event.relative.y, 0) CAMERA_MOVE_SPEED);
elif (mode == 2):
camera.rotate_y(event.relative.x CAMERA_ROTATE_SPEED);
elif (mode == 3):
camera.translate(Vector3(0, 0, event.relative.y * CAMERA_ZOOM_SPEED))
But rotate of Camera seems wrong. It just middle point of spatial should rotate like Substance Designer - If you have used Substance Designer and you have tried to play Preview of 3D view example cube you move, rotate and zoom if you press mouse button and if you release ( unpress ) moving, rotation or zooming will stop....
For rotate I have resolved yeah it is from Spatial's rotate because It looks like 3D view from Substance Designer :smiley:
Wow I am happy because I have resolved it.
But rotate_x and rotate_y looks weird. I show you like that? Example from Substance Designer