Jump to content

Direct rotation (not "smooth" and prettier 359 -> 0)


david476

Recommended Posts

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).

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Announcements



×
×
  • Create New...

Important Information

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