- Home /
Move / Place objects on plane in 3D space
Hey everyone. I have been trying to figure this out for myself but I don't have it exactly right. I have checked a few examples but nothing has really worked the way I want it to.
What I am trying to do is to move / place and object on a plane in 3d space based on my mouse position. The game I am currently working on is in an isometric view. Not sure if that makes a difference in the scripting of this or not but I would appreciate any help I could get on it. Thanks.
Answer by ZacGarby · Sep 26, 2015 at 09:19 PM
In the Camera class, I believe there is a function to return a Ray from the mouse position. You could get this ray, and create a RaycastHit variable and set it to a ray cast with the direction as the ray's direction. Then, move/place and object at the RaycastHit.point. This will work, provided the raycast hits something's collider.
Your answer

Follow this Question
Related Questions
spawn and drag game object without leaving mouse button 1 Answer
Following instruction for drag and drop 3d object unity but not working 1 Answer
How can I drag just one object, but not all the objects ? (Android) 1 Answer
Can I make a non UI gameObject draggable by implementing the IDragHandler interface? 2 Answers
Jigsaw Puzzle Drag & Drop issues. 0 Answers