Jump to content

Thrown Item Rendering Question


Danickar

Recommended Posts

So I have a Disc item (basically a Frisbee) that I can throw.  It has its own ThrownEntity and Renderer files.  My problem is when I throw the disc it looks just like a circle getting smaller as it moves away.  I want it to look more flat, like a Frisbee would when you throw it.  I messed around with some of the values in the renderer and got it to "go flat" but then it also becomes impossible to see as it has no thickness.

 

Anyone have any experience with doing this?

Link to comment
Share on other sites

Rotate it slightly so that it isn't 100% horizontal, then it shouldn't be so "thin" as to vanish.

Are you using a custom model for your disk or is the disk just simply drawn as lines using GL11 methods in the render method? :)

 

Also, showing your code where it seems to vanish would help the GL11 proficient folks here able to spot the error in your code much more easily than by the use of mind reading machines. (Besides I think draco's MentalCodeReading hat is out of order atm :P )

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon)
    {
        float f = par2Icon.getMinU();
        float f1 = par2Icon.getMaxU();
        float f2 = par2Icon.getMinV();
        float f3 = par2Icon.getMaxV();
        float f4 = 1.0F;
        float f5 = 0.5F;
        float f6 = 0.25F;
        GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
        par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
        par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
        par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
        par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
        par1Tessellator.draw();
    }

 

So, if I take out the 180.0F from the rotateY I was able to get it to go flat.  I seem to get the same response if I add 180.0F in front of the rotateX.  I am not sure this is the best method or not.  I took this render code from the RenderSnowball code.

Link to comment
Share on other sites

I've tried all sorts of combinations of numbers messing with rotateY and rotateX.  I can get "close" to what I would be looking for, but no real success.  Part of the problem seems to be that the item is completely flat when thrown.  Is there a way to give it thickness so that when it is flat like a frisbee you can still see it?

Link to comment
Share on other sites

Hi

 

Minecraft has a method to do this (take a 2D texture and turn it into a "slice" with thickness), you should be able to adapt it without too much trouble..?

 

ItemRenderer:
    /**
     * Renders an item held in hand as a 2D texture with thickness
     */
    public static void renderItemIn2D(Tessellator par0Tessellator, float par1, float par2, float par3, float par4, int par5, int par6, float thickness)

 

see also

http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-dropped-items.html

http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-first-person-view-items.html

 

-TGG

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.