I don’t know how it works with these extensions, but with the old and well made Rendercam it’s simple:
local up = vmath.vector3(0, 1, 0)
local pivot = vmath.vector3(0, 8, 0)
...
self.look_at = rendercam.screen_to_world_plane(action.screen_x, action.screen_y, up, pivot)
...
works with any camera angle because it doesn’t matter. We know the position of objects and the cursor in the world coordinate system.
Also I prefer euler.y
instead quat for the hero rotation.
local angle = lume.angle(self.look_at.x, self.look_at.z, self.position.x, self.position.z)
self.angle = -math.deg(angle) - 90 -- depends on origin model rotation
local old_angle = go.get(self.dude, "euler.y")
go.set(self.dude, "euler.y", math3d.lerp_angle(.92, self.angle, old_angle))