We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a few questions: Which order is best for XYZ rotation, and how do I transform keypresses to "pull" an object (or some objects) down, up, left, or right? I tried making a perspective vector, but I had no idea what I was doing, and failed. Could someone perhaps attach some code of "pulling" a cube in certain directions by pressing the arrow keys? This would be incredibly useful for a 3-D Minecraft clone, rather than a 2-D version I decided to develop instead.
Answers
While writing the main post, I realized that you should rotate the camera in the opposite direction. Not only does it work just as well, it makes it easier to rotate multiple objects, and enables panning and zooming.
Solved?
do you use peasy cam?
here is a version with wasd / pl / space bar
without peasy cam
new version with full peasy cam support, only 4 lines more ; you can rotate scene with mouse now (you need to install library: Menu | Import library | Add library)
in this version you have the current box/sphere/folded triangle shape that you can move. With return you can add it to the list of all objects.
This version makes use of a class "Box3D" and of objects that are stored in an
ArrayList
boxes. For class and objects see tutorial:https://www.processing.org/tutorials/objects/
Chrisir ;-)
there is still a lot to do:
technically the variables translatex,translatey,translatez, sizeBox etc. before setup() are not necessary but should be just Box3D placingBox; or so.
rotation of one block is not supported
no color selector
no textures for boxes
no save and load scenes
no PLAY mode where you can just look at the scene (run through it) without editing it
Chrisir ;-)
Thank you! This has solved my problem. Also, here is the code, modified to suit my needs:
;-)
This thread has been closed, in favor of QueasyCam. You can now stop commenting.
P.S. I looked at the source code, and it uses camera(). I copied down the source code, and embedded it in my own script. Here it is, for a TerraTech clone instead of a Minecraft clone:
Also, I forgot to include these lines at the very beginning, for the robot:
Thank you!
You're welcome!