Jump to content

[SOLVED] [1.8] Rotating Model Based On Yaw / Pitch


EverythingGames

Recommended Posts

Hi

I have rendered an arm model but the problem is that I want it to stay in front of the player much like the vanilla first person arm. I tried rotating the model based on pitch and yaw of the vanilla arm but most of it goes wrong. The yaw works fine for rotating the model up and down (in fact, it does that perfectly from what I can tell). The pitch, however, because of the model's offset / axis rotates in a weird way. Instead of rotating with the player, when the player's pitch is changed the arm tries to rotate - when it does the arm rotates in a circular motion (a simple example would be the circular motion of a drill bit, for instance). How do I correctly rotate the model ignoring the fact that the offset is at the end of the model? I hope that made sense and thanks if you are able to help out!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

Before attempting any kind of animating, it is very important that your model is correct. If any rotation points are off or pieces of the model are acting independently (i.e. not added as children of a parent part), then you are just making the task 1000x more difficult than it should be.

 

If your model is all set up correctly, then be aware that the axis of rotation is also affected by the model itself - if you have a box that is rotated naturally by some amount, the yaw/roll/pitch axes are relative to the box's rotation, not necessarily that of the entity.

Link to comment
Share on other sites

Thanks, coolAlias. My model is exactly the same as the vanilla model arm from the ModelPlayer class. The dimensions, texture UV, etc. The vanilla rendering of the first person hand starts in the ItemRenderer class and eventually calls a method ModelPlayer. Do you know how to actually make the model move or become attached to the player like a regular player part (such as the head or arm)? If I can do that, I can just call several GL functions to get it in front of the player and only enable first person rendering to get what I want.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

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.