I was able to code a very basic click and drag (with a lot of help from the internet) but the problem with what I ended up with is I can only drag an object from the view of the camera. If you want to see what I mean here is my code:
public class mouseDrag : MonoBehaviour
float distance = 20;
Vector3 mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);
Vector3 objPosition = Camera.main.ScreenToWorldPoint(mousePosition);
transform.position = objPosition;
Create an object, create a plane beneath the object then apply this code to the object you want to pick up. With this it will bring the object up to the main camera when you click the object. Then you can drag it along any axis as long as it’s adjacent to the main camera. This wrong.
This doesn’t work for me because i’m trying to make a table top simulator where you drag items onto a gridded playing board with an Isometric 3D camera angel that can move it’s position to see other angels of the board. And even if I wanted a top down view of the board, I still wouldn’t use this because it’s such a terrible and lazy roundabout way of doing things.
Imagine something like this chess set but I can freely move each peace where every I want on the chess board.
I have given it all I got and I can’t come up with shit. Also I am new to BrackeysForums and I love the layout of this place. I hope to get allot of use out of here.