Hi! As the title states, I’m creating a drag system to move gameobjects around, and I would like the function that allows the card to follow my mouse cursor to take perspective into account.
As it is right now, here’s said function (and yes I know it’s very janky) :
(Note that I want my cards to be moving on a 2D plane, never moving them on the Z-axis)
There are obviously a ton of ways to improve that, but the more tutorials I follow, the more confused I am as to what technic I should be using and how to apply it. What I need is for my mouse position to take perspective into account, that is, if my mouse is on the bottom left of my near clip plane, the ray it casts should also be hitting the bottom left of my far clip plane.
Sorry if that isn’t very clear, and thanks a lof your help !
Could you perhaps post the entire function? With what you’ve given us its kinda hard to help you.
Just pick a tutorial and follow it. If the end result is not what you were looking for, then rinse and repeat with another one. It’s a great way of learning how to code by doing it yourself.
I do not understand why you are saying this (as I said, needs more code), just cast a ray at the mouse position and it will get any card that is “under” your mouse no?