Jump to content

Recommended Posts

Posted

It is that simple.

 

Use Pre event to rotate and Post event to rotate BACK! Yes you will use 2 events.

1.7.10 is no longer supported by forge, you are on your own.

Posted

If you want roll then i highly recommend using quaternions rather than vectors.  Otherwise you will quickly run into problems, the main one being gimbal lock.  That is where vectors effectively break down and don't display the rotation correctly.

 

The problem is quaternions can very difficult to work with as a developer and debugging rotations can be soul destroying.

 

Other tips that I would add:

 

- Minecraft treats zero rotation as the player looking down the z axis, whereas quaternions and math in general treat as the x axis. (Please correct me if that's wrong).  So you'll need to do 90 degree rotation to the left when calling most quaternion library code.

 

- You can change the player's roll by setting the private 'camRoll' field in EntityRenderer class, using reflection.

 

- You should ensure the z axis rotation is capped between -90 and 90 degrees (pitch).  The x and y axis rotations should be between -180 and 180.  The player will still be able to do loops in any direction, but the minecraft code kind of requires these values (speaking roughly).

 

- When converting from Euler angles to quaternion (e.g. when reading current player rotation) you should ensure you use YZX order.  This ensures that roll is done last.  Same for converting from quaternion to Euler.  That will sound confusing if you haven't dealt with it before but it's a problem that caused me over a week of debugging so maybe bookmark this if you choose to go down this path.  Other orders may be ok but the standard XYZ order does roll before it does pitch which is wrong.

 

- If you simply add a 360 degree rotation to the player, the player will spin around quickly in-game.  You would think they would just stay still but the minecraft code interpolates between the two values automatically.  This can be a problem if your rotation formulas decide to add 360 degrees etc..  This is related to the point about keeping the y axis between -90 and 90 degrees.

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.