Drag object go wrong

When I use stylus to drag an object in a closed room, the dragged object goes behind the wall of the room。
How do I solve the problem of not letting the object being dragged through the wall?

zCore doesn’t supply a solution to do this. You will have to implement it yourself. If you want to stop it from going past a wall that is orthogonal to world coordinates, then you can simply modify the draggable.cs with something to the effect of…

if(object.position.z > wall.position.z){
object.position.z = wall.position.z;

If you want something more complex where your dragged object doesn’t intersect many different complex objects in the scene, then your best option may be to rewrite the draggable script to apply force vectors to the dragged object’s rigidbody rather than directly setting the object’s position. I do not currently have any examples to share of this working.

Alex S