I have a scene and when I move the object (cubeMesh)
with the keyboard, I need to create limits on the scene so the object don't disappear from the scene.
Can I make it with two planes on each side?
Is there any simple code for that?
Asked
Active
Viewed 371 times
0

Pedro
- 51
- 1
- 8
-
Hey Pedro, there's a number of ways to tackle this. However, the requirement "so the object don't disappear from the scene" is ambiguous. Stopping an object from moving beyond an arbitrary boundary is trivial. Figuring out if an object is about to move out of camera frustum is a bit different. See http://stackoverflow.com/questions/10858599/how-to-determine-if-plane-is-in-three-js-camera-frustum to check if an object is in frustum. You can use this check to decide wether or not to nudge the object any further via the keyboard inputs. – Radio Jan 19 '17 at 21:44
-
Thank you Radio! I'll check that. It seems to be good and it should help me. mrdoob is the best right, so it's perfect. – Pedro Jan 19 '17 at 22:47
-
Can you give me any example? I've tried to use that code but i couldn't. – Pedro Jan 19 '17 at 23:22