使用鼠标将3D对象拖动3D对象。
我试图在墙壁上实现一个物体的运动,而不仅仅是一个平面。在此示例,一个对象通过以下方式拖动墙壁:
intersects = raycaster.intersectObjects([walls]);
object.position.copy(intersects[0].point);
但是,使用此方法,对象,对象跳跃因为对象的中心移至鼠标。有一个相关问题并且有用的JSFIDDLE用于在没有跳跃的一个平面上拖动的JSFIDDLE,请帮助我将其修改为倍数飞机(墙壁)?谢谢
I am trying to achieve movement of an object on walls, instead of only one plane. In this example, an object dragged on walls by using:
intersects = raycaster.intersectObjects([walls]);
object.position.copy(intersects[0].point);
However, with this method, the object jumps because the object's center moves to the mouse. There is a related question and helpful JSFiddle for dragging on one plane without jumpin Would you please help me to modify it for multiples planes (walls)? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读了您的评论后,我认为您要寻找的是您希望对象为该位置动画。您可以做几种方法。 “三j”的方法是将其移动每个帧(在动画/更新循环中)。您可以使用 vector3.lerp 通过存储
相交[0] .point
作为您的目标位置,并将您的object.position.position.position
转到每个帧。另一个选项是使用动画库(例如AnimeJS或GSAP)。After reading your comment, I think what you're looking for is you want the object to animate to the position. You can do this a few ways. The "threejs" way is to move it each frame (within the animate/update loop). You could do this with Vector3.lerp by storing
intersects[0].point
as your target location and lerping yourobject.position
to it each frame. Another option is to use an animation library like animejs or gsap.