Search the Community
Showing results for tags 'snap'.
-
Is there a way to make the arcRotateCamera snap to certain points? I want it to snap to areas of interest when its being spun around only on the Y-axis.
-
Hey all, I'm looking for some direction on snapping objects into position against other objects edges. I'm also looking to define a snap point on an object and use that to lock it into another objects corresponding point. The first problem is essentially voxel drawing with irregular sized objects (all prisms), I need to be able to click on a face and have the new object placed in relation to the face that I clicked. So if I cast a ray and it finds the top face of an object, the new objects bottom face should align with it. (and snap to whichever side edge the mouse was closer to?) I imagine the second problem as having a little sphere attached to the objects mesh in an arbitrary location, and using that spheres center point to snap into the nearest objects corresponding anchor point. Like defining a hook on an object and using it to snap onto a clothesline. The Babylon.js API is pretty huge and I'm not at all familiar with it, but I have a reasonable grasp of the concepts involved. Any direction or suggestions on how to make a system as I described work would be greatly appreciated.
-
I noticed that if I drag the atari1 sprite in the snap.php example, the sprite will snap up or left after a much smaller drag distance, than if I drag it down or right. Especially with smaller sprites this is very noticeable and feels odd. Is there a way to change this? Neither setting the sprite anchor to (0.5,0.5) nor setting a snapOffset seems to help. EDIT: Ok, I found a way to fix this. I changed Math.floor to Math.round in InputHander.updateDrag: if (this.snapOnDrag){ this.sprite.x = Math.round(this.sprite.x / this.snapX) * this.snapX; this.sprite.y = Math.round(this.sprite.y / this.snapY) * this.snapY;}This way drag&snap handles much better in my opinion.