How can I hide the axes in TransformControls? Whenever I hide one axis, two axes are displayed. If I hide two axes, TransformControls no longer works. My goal is: I don’t want any axes to be displayed since I don’t need them. I only need the XZ plane, marked as a pink square, but this doesn’t seem to work.
When I click on an object, I want to be able to move it freely on the XZ plane, similar to how it works in Sims 4. Do you understand what I mean? I want to click on an object and move it freely in the scene.
Thank you very much for your suggestions and solutions! I really appreciate it!
Hello Seanwasare,
Thank you very much for your feedback! I have an interactive scene, and I am only partially using raycasting. My floor is not recognized as a bounding box. In your example code, there are boxes on the floor, and the objects are assigned to these boxes. This doesn’t work for me since I don’t have these boxes on the floor.
Do you perhaps have any other solutions? Thank you again!
do you mean the grid helper?
thats just visual.
you can delete it from the code, press ctrls and it will still work.
1 Like
Oh ok… thank you very much!
Do you have also another solutions for my other posts ?
Thanks for the solution! Can you Tell me also how can I rotate placeholder objects without transformcontrols ?
To achieve your requirement of moving an object only on the XZ plane, you can easily implement it using Three.js DragControls. While DragControls allow an object to move in 3D space, we only need movement constrained to the XZ plane. This can be accomplished by leveraging the MathUtils.clamp
function to restrict the object’s position within the desired bounds.
Here’s an example:
body.position.x = THREE.MathUtils.clamp(body.position.x, minXBound, maxXBound);
body.position.y = THREE.MathUtils.clamp(body.position.y, 0, 0); // Restrict to Y = 0
body.position.z = THREE.MathUtils.clamp(body.position.z, minZBound, maxZBound);
Thanks!
Thanks for you response, I will try it !