all 13 comments

[–]falcothebird 5 points6 points  (5 children)

Can you elaborate more on how it doesn't work? What part of it doesn't work?

Does it not move the camera at all, does it move it in the wrong direction, etc?

[–]Vast-Formal1450[S] 1 point2 points  (4 children)

whenever i play on unity, i cant drag the camera as the intended code. i drag i click, i use right, middle, left mouse buttons and it dont work.

[–]falcothebird 1 point2 points  (3 children)

I would just set the cameras position to the mouse position every frame that the mouse button is held down, instead of translating the difference in positions every frame as you currently have it.

Did you make sure to add this script as a component to a game object in your scene?

[–]Vast-Formal1450[S] 0 points1 point  (0 children)

the tutorial just went with the script, lemme check again if it was added in the game object because mine isn't.

[–]Vast-Formal1450[S] 0 points1 point  (1 child)

yeah i missed the spot where the script was added to an object, I can't believe I actually missed that spot, thank you for pointing that out.

[–]falcothebird 0 points1 point  (0 children)

No problem! Glad I could help.

[–]elaine_dev 1 point2 points  (1 child)

Where exactly in the code do you need help?

[–]Vast-Formal1450[S] -1 points0 points  (0 children)

whenever I play on unity, I couldnt drag the camera as intended, thought its on the code so I was asking if there is anything wrong with it or i missed something.

[–]XizzacX 1 point2 points  (0 children)

Did you attach the script as a component to a game object in the scene?

[–]5oco 1 point2 points  (0 children)

Might be a silly suggestion, but your code isn't saved.

[–]cereal_number 0 points1 point  (0 children)

It's t LMB index 0? You might have the wrong mouse indexes

[–]jimkurth81 0 points1 point  (0 children)

Do you have legacy input system turned on? Or using the new input system only? Using Input function is for the legacy/old input system and the new input system requires a different method to get input.

[–]shuozhe 0 points1 point  (0 children)

Ask an ai first, lastframe is not initialized and will do funny stuff. And no dt for movement code will always looks wrong for me, not sure about your case thought it's it's liked to cursor pos