Posted August 24, 201411 yr Hello, I am trying to make a custom modeled bock change direction when I place it, as well as make it shoot a laser I have no idea how to. Thanks.
August 24, 201411 yr Well, it is just a simple matter of rotating the model itself instead of the block. So for instance, if you're using an wavefront model you can just call GL11.glrotatef(angle, xvector, yvector, zvector); before you render your model.
August 24, 201411 yr Author because I don't know what a wavefront model is I probably ain't using one.
August 24, 201411 yr Well, what are you using then? The hardcoded way(tesselator)? Let me add some stuff since it seems that isn't the only place you are stuck. You can get the way the player is facing with int l = MathHelper.floor_double((double)(Player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int the onBlockPlacedBy method. Then write that value to metadata. In your renderclass just read the metadata again and rotate the object accordingly(e.g. 2 == 0°, 3 == 90°, 4 == 180° & 5 == 270° or something like that) and between your GL11.glpushMatrix() and gl11.glPopMatrix you just place GL11.rotatef(yourpreviouslycalculatedangle, 0.0, 1.0f, 0.0f); and this should actually work with whatever type of model you use.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.