Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Is there a way to render exactly the rotation value without the "nice" smooth rotation or the weird turning that happens when you go from 359 degrees to 0?

Are you talking about GL.glRotated(x, y, z, rot)?

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

  • Author

I use rotatef, but whatever causes the problem (setting the yaw does seem to do it too, but could be happening in client syncing)

  • Author

I'll try, but just for a better explanation...

 

Rotations for my entity are "smooth", they do not seem to get perfectly set exactly to the variable's value (renders are made into a consistent > 20 fps rotation). As a part of this, when the rotation variable I set goes from 359 to 0, the model rotates 359 degrees backwards instead of 1 in the right direction to get to 0(in a fraction of a second).

  • Author

Note: rotations are being set to a entityRiding's (a player's in my case) yaw.

Shouldn't that be just a mathematical problem using the PartialTickTime and the update tick?

 

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

I'll try, but just for a better explanation...

 

Rotations for my entity are "smooth", they do not seem to get perfectly set exactly to the variable's value (renders are made into a consistent > 20 fps rotation). As a part of this, when the rotation variable I set goes from 359 to 0, the model rotates 359 degrees backwards instead of 1 in the right direction to get to 0(in a fraction of a second).

 

Can you post your code?  You're probably just not handling that case (of going past 360) properly.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

using:

 

if (ShipCSeat != null && ShipCSeat.riddenByEntity instanceof EntityPlayer) {

EntityPlayer player = (EntityPlayer) this.ShipCSeat.riddenByEntity;

this.setRotation(player.rotationYaw, 0);

}

 

in an onUpdate class that calls super. ShipCSeat is the entity that the player actually rides retrieved from server on server using UUID.

I'm not really sure why that code would cause any problem with rotating past 360.  You're just setting the rotationYaw of your ship to match your player that is riding it.  Where is the "smooth" rotation happening that is causing the problem?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Hi

 

I still don't understand your question, but a random idea: try setting prevRotationYaw as well as rotationYaw.

 

-TGG

  • Author

Shouldn't that be happening on the Entity class's onEntityUpdate that I call at the beginning of onUpdate with super.onUpdate();? Maybe that needs to be sent client side? Seemed to me like onUpdate wasn't being called on both sides...

  • Author

Update: It looks like this still happens when I just add to the rotation, so not a problem with using an entityPlayer's yaw.

I'm still not sure of your problem.  You're saying that if you change the rotation, that it will slowly go towards that rotation and in case where it is near 360 it will go the wrong way around?

 

I thought setting the rotation would immediately rotate it.  I'm not sure where it is doing the "smooth rotation" code.  But you need to find that because that is where it would have to handle the case of going past the full circle.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Is your ship very wide/long? If so, I think you're talking about how the end of your ship is rotated very rigidly.

 

This is to be expected due to the fact that the farther away an object is from the center of rotation, the more space it will travel to fulfill the rotation.

Kain

  • 1 month later...
  • Author

Haven't been modding in a while but went back in and just using my own variable seems to work fine. Still has the smooth/ lagginess but I think that is just the actual rotation of the player...

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.