Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I add a vector based on rotation?

Asked by 6 years ago

I'm having a part follow the mouse. But when the player isn't facing a certain direction, mouse movements don't coordinate with where the part moves.

I tried using lookVectors as well but don't have a good understanding of using them.

local function Panned(input, processed)
    if not processed and input.UserInputType == Enum.UserInputType.MouseMovement then
     delta = input.Delta
    panDeltaMouse = -delta
    move_vector =focus.Position-Vector3.new(delta.X,0,delta.Y)*speed -- need help here
    end
end

1 answer

Log in to vote
0
Answered by 6 years ago

You can use the .Move to detect mouse movement and set the part's position as Mouse.Hit.p (a vector3 position)

local Mouse = game.Players.LocalPlayer:GetMouse()
local Part = workspace.Part

Mouse.Move:connect(function()
    Part.Position  = Mouse.Hit.p
end)
0
Has to use delta as is. I'm making a draggable camera. Everything works except for when orientation is off. ICosmicReaver 32 — 6y
Ad

Answer this question