Hi, I’ve drag control on the object set it’s mode to Snap to surface. But the object keep getting inside the surface when I try to move it, instead of staying over it.
I don’t have any collider on the object and the surface im using is a plane.
Is there something I have to add or look for on the surface or object so it works properly?
To ensure that your object properly snaps to the surface, you might need to consider the following steps:
Check Snap Settings: Make sure the snapping settings are correctly configured. If there’s an option to set snap offsets or distances, ensure it’s not allowing the object to penetrate the surface.
Add Colliders: Even though you mentioned there are no colliders, try adding a collider (e.g., a box collider) to both the object and the plane. This might help the snap process to calculate the surface interaction more reliably.
Surface Normal: Verify that the normals of the plane are facing upwards. If they are inverted, snapping might not behave as expected.
Height Offset: If the tool or software has the ability to set a snap height offset, ensure it’s correctly set to prevent objects from penetrating the surface.
Drag Control Options: Double-check the options in the drag control settings to ensure they are not set to ignore surface interactions.
Script Adjustments: If this is being handled in a script, ensure the logic doesn’t allow the object to move through the plane under any conditions.
If these don’t resolve the issue, could you provide more details or logs from Needle Engine or Unity for further inspection? You can use the “Copy Project Info Into Clipboard” option in Unity to provide the necessary context.
24 replies left thread_AogMKKOVh84at4iKhmKIGghk Reply to this message to continue the conversation
Thank you for providing the images. Given that both the cube and the ground have box colliders, here’s a checklist to help troubleshoot why the snapping might not be working correctly:
Collider Size: Ensure that the colliders’ sizes are appropriately set, especially for the cube. If the collider is smaller or not aligned with the visual representation of the cube, it may not snap as expected.
Snap Distance Settings: Look for any settings related to the snap distance or offset in the dragging control setup. Ensure that this is not set too low, which might allow the cube to intersect with the ground.
Physics Settings: Check the physics settings in your project. Sometimes, settings related to gravity or collision layers may affect how objects interact with each other.
Z-Axis Positioning: Make sure the cube isn’t initially positioned below the plane. If it starts below the surface, it will likely snap to the ground and visually appear to penetrate it.
Snap to Surface Implementation: Ensure that the snap to surface behavior is correctly implemented in your code or setup. If you have any scripts that manage the dragging and snapping, verify that they correctly reference the colliders.
Object Layer: If your objects are on different layers, check that the layers are set to interact in the physics settings.
If you still face issues after these checks, consider providing logs from Needle Engine using the “Help/Needle/Logs” option for deeper insights.
24 replies left thread_AogMKKOVh84at4iKhmKIGghk Reply to this message to continue the conversation
I understand this issue can be frustrating. To provide more tailored assistance, could you please share the logs from Needle Engine? You can find these in the “Help/Needle/Logs” menu. This will help me diagnose the problem more specifically.
24 replies left thread_AogMKKOVh84at4iKhmKIGghk Reply to this message to continue the conversation
Colliders are not necessary on any object (they’re just used for physics calculations).
The snap to surface detects the closest surface point below the cursor (it ignored the object that you’re currently dragging). Is it possible that your floor is on the IgnoreRaycast layer?
Hi, it’s caused by DragControls set to SnapToSurface was not handling the rotation of the object. It will be fixed in the next release. Until then you could try to eliminate the rotation of your room model
Yes, the model must currently not be rotated at all (Mesh_25 + none of the parents, so it would need to be fixed in your 3D software to apply the rotation to the geometry)