Getvieuwport() cannot be found. Look at Mouse in godot 4.0

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RohanLockley

Hello all,

i picked up the godot engine a short while ago, coming from unity before.
a specific issue i have now is with raycasting, which i need to make a gameobject look at the mouse in worldspace.
(Exactly like the example in this video: https://www.youtube.com/watch?v=mmvIkkKJVlQ )
I know that starting in 4.0 means some stuff has changed, and 'm pretty sure my raycast syntax itself is ok, but the issue arises in finding .get_vieuwport()

When i attatch the script to a 3d node/camera/player… i got the error stating that the function getvieuwport() cannot be found on self.
i have scoured the internet for hours on end, but nowhere do i find a solution.
is this solvable with attachign a subvieuwport in the node hierarchy and somehow referencing this?

:bust_in_silhouette: Reply From: jgodfrey

You have a typo in that code. That should be get_viewport() (not get_vieuwport())

Oh my do i feel ridiculous, it seems to work like a charm!

RohanLockley | 2022-12-26 19:21