![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | JowannoSebastiano |
![]() |
Old Version | Published before Godot 3 was released. |
Guys, hello.
There is a trouble with making my weapon looking at the mouse.
The code I use is:
extends Sprite
func _process(delta):
var mpos = get_viewport().get_mouse_pos()
look_at(mpos)
func _ready():
set_process(true)
–
P.S. I saw an example “LookAtMouse”, there is no need to talk about it.
can you give more information? what is happening with the gun? its not moving at all? its moving weird? looking at look_at
Method in godot, it takes two Vector3
arguments.
tiernich | 2016-03-30 15:41
It moves weird, right.
So how can I solve it?
JowannoSebastiano | 2016-03-30 19:25
Have you set the rotation point of sprite?
puppetmaster- | 2016-03-31 06:50
yes, I have.
I think, it is because it rotates relative to viewport, not the character.
If you add Camera2d node to demo “Look at pointer”, you’ll see the same problem
JowannoSebastiano | 2016-03-31 10:40