Hello. I made a simple inventory system where the user can drag from 2D inventory to 3D world an item. Or at least I’m trying too. I’m a bit stuck with the logistics because I don’t know how to really handle this as I am a beginner in programming and definitely a beginner in Unreal.
So when I drag the 2D item from the inventory I just simply detect if the sprite is out of that inventory area and then Spawn a 3D objects accordingly. I spawn it in the front of the First Person camera by detecting the mouse position and adding few units in front.
The first problem is that I can spawn objects on the other side of the walls if I am too close to a wall, or a door, or anything. So i made something that I think is hacking and dangerous. I cast a ray from the mouse position and if the closest object that intersects is too close (the distance is smaller than my spawning distance) I avoid spawning the object. Any other idea of solving that?
The second and the most annoying problem is when I move the 3D object that I spawned in 3D world by moving the mouse. I simply move the actor by SetActorLocation. If it has physics on I can force the object inside other objects. I understand that is not the way to do it. I don’t know whats the best way to move the object based on the mouse position in the world and when it reaches another physical object to just stop moving. How to use forces or something else based on mouse movement and I don’t know what kind of proprieties the physical items should have.
https://www.youtube.com/watch?v=mGi_…ature=youtu.be
Thank you.