Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Direct rotation (not "smooth" and prettier 359 -> 0)
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
david476

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

By david476, September 29, 2014 in Modder Support

  • Start new topic

Recommended Posts

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted September 29, 2014

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?

Share this post


Link to post
Share on other sites

Busti    72

Busti

Busti    72

  • Dragon Slayer
  • Busti
  • Forge Modder
  • 72
  • 624 posts
Posted September 29, 2014

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.

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted September 29, 2014

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

Share this post


Link to post
Share on other sites

TheGreyGhost    819

TheGreyGhost

TheGreyGhost    819

  • Reality Controller
  • TheGreyGhost
  • Members
  • 819
  • 3280 posts
Posted September 29, 2014

Hi

 

To be honest I have no idea what you're talking about, could you post a video perhaps?

 

-TGG

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted October 1, 2014

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

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted October 1, 2014

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

Share this post


Link to post
Share on other sites

Busti    72

Busti

Busti    72

  • Dragon Slayer
  • Busti
  • Forge Modder
  • 72
  • 624 posts
Posted October 1, 2014

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.

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted October 1, 2014

New terms to me! Want to expand on them?

Share this post


Link to post
Share on other sites

jabelar    593

jabelar

jabelar    593

  • Reality Controller
  • jabelar
  • Members
  • 593
  • 3266 posts
Posted October 1, 2014

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/

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted October 2, 2014

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.

Share this post


Link to post
Share on other sites

jabelar    593

jabelar

jabelar    593

  • Reality Controller
  • jabelar
  • Members
  • 593
  • 3266 posts
Posted October 2, 2014

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/

Share this post


Link to post
Share on other sites

TheGreyGhost    819

TheGreyGhost

TheGreyGhost    819

  • Reality Controller
  • TheGreyGhost
  • Members
  • 819
  • 3280 posts
Posted October 2, 2014

Hi

 

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

 

-TGG

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted October 3, 2014

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

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted October 3, 2014

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

Share this post


Link to post
Share on other sites

jabelar    593

jabelar

jabelar    593

  • Reality Controller
  • jabelar
  • Members
  • 593
  • 3266 posts
Posted October 3, 2014

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/

Share this post


Link to post
Share on other sites

TLHPoE    39

TLHPoE

TLHPoE    39

  • Dragon Slayer
  • TLHPoE
  • Members
  • 39
  • 638 posts
Posted October 3, 2014

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

Share this post


Link to post
Share on other sites

david476    10

david476

david476    10

  • Creeper Killer
  • david476
  • Members
  • 10
  • 238 posts
Posted November 15, 2014

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

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Jack Richard
      [1.15.2] Minecraft Registry Problem When Loading from Jar

      By Jack Richard · Posted 1 hour ago

      Thanks so much for your help! I removed the log4j dependency, I honesty don't remember when I put that there. Once I fixed the jar.finalizedBy line, everything worked! (One small issue where I was relocating all of "com.google" when I just should've relocated "com.google.common," too)   Thanks again!
    • Teedledee
      1.16.4 Failed to synchronize registry data with server LAN

      By Teedledee · Posted 1 hour ago

      Fixed the issue, one config didnt match, downloaded randompatches to solve badly compressed packet afterwards.
    • DaemonUmbra
      [1.15.2] Minecraft Registry Problem When Loading from Jar

      By DaemonUmbra · Posted 2 hours ago

      First of all, why are you shadowing log4j? Minecraft already provides log4j2. Second if build is running shadowjar instead of jar then you might need to tweak the line where it says jar.finalizedBy('reobfJar') to finalize shadowJar instead
    • DaemonUmbra
      "The game crashed whilst rendering overlay"

      By DaemonUmbra · Posted 2 hours ago

      What do you think you should do about this?
    • DaemonUmbra
      IntelliJ doesn't include resources folder while debugging

      By DaemonUmbra · Posted 2 hours ago

      What version of Minecraft are you using?
  • Topics

    • Jack Richard
      2
      [1.15.2] Minecraft Registry Problem When Loading from Jar

      By Jack Richard
      Started 2 hours ago

    • Teedledee
      2
      1.16.4 Failed to synchronize registry data with server LAN

      By Teedledee
      Started January 18

    • GuyWithTVHead
      1
      "The game crashed whilst rendering overlay"

      By GuyWithTVHead
      Started 2 hours ago

    • GermanBucket
      2
      IntelliJ doesn't include resources folder while debugging

      By GermanBucket
      Started 4 hours ago

    • Arthurmeade12
      8
      Error Conecting to My Minecraft Server

      By Arthurmeade12
      Started Saturday at 11:05 PM

  • Who's Online (See full list)

    • ChampionAsh5357
    • Rosy162
    • DaemonUmbra
    • DynamicSiren
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Direct rotation (not "smooth" and prettier 359 -> 0)
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community