Jump to content

Recommended Posts

Posted (edited)

Not sure what I've messed up here, but I've been trying to scale the player model, and basically no matter what value I try to scale to, the player is like the size of a house. Any ideas of what's going wrong here?

    @SubscribeEvent
    public void preRenderPlayer(RenderPlayerEvent.Pre event) {
        event.getMatrixStack().scale(0.25f, 0.5f, 0.25f);
        event.getMatrixStack().pop();
        event.getMatrixStack().push();
    }

    @SubscribeEvent
    public void postRenderPlayer(RenderPlayerEvent.Post event) {
        event.getMatrixStack().getLast();
    }

 

Edited by jstN0body
Posted
        event.getMatrixStack().scale(0.25f, 0.5f, 0.25f);
        event.getMatrixStack().pop();
        event.getMatrixStack().push();

You should call MatrixStack#push then do your own transformations, and pop afterwards (after finish your rendering).

Afaik you can't just scale the player's model there, you need to hide them in Pre and render them yourself in Post.

 

  • Thanks 1
Posted

Working code snippet for anyone who wants it:

    @SubscribeEvent
    public void preRenderPlayer(RenderPlayerEvent.Pre event) {
        event.getMatrixStack().push();
        event.getMatrixStack().scale(0.5f, 0.5f, 0.5f);
    }

    @SubscribeEvent
    public void postRenderPlayer(RenderPlayerEvent.Post event) {
        event.getMatrixStack().pop();
    }

 

  • Thanks 1

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.