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    818

TheGreyGhost

TheGreyGhost    818

  • Reality Controller
  • TheGreyGhost
  • Members
  • 818
  • 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    818

TheGreyGhost

TheGreyGhost    818

  • Reality Controller
  • TheGreyGhost
  • Members
  • 818
  • 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

    • Sr_endi
      [1.16.4]How to set the light value of an block

      By Sr_endi · Posted 5 minutes ago

      Thank you! I will try that.
    • Ironhead_
      Failure message: Missing License Information in file Mod File

      By Ironhead_ · Posted 46 minutes ago

      I'm playing on 1.14.4 and am only using the create mod, however I'm having to resort to adding JEI to see some recipes I'm stuck on. it doesn't let me use JEI without a licence
    • diesieben07
      (1.16.2) How do I use onPlayerTick?

      By diesieben07 · Posted 56 minutes ago

      This will immediately crash the game, there are not just server side entities. The fact that it doesn't mean your event handler is not even running. It is not running, because @EventBusSubscriber only works with static event handler methods.
    • diesieben07
      7 FPS with a GT 1030 + i5-4690 (1.16.3)

      By diesieben07 · Posted 58 minutes ago

      "Forge fix your terrible performance! this is horrible!" "Oh, I was using a mod that hugely increases render and world simulation load. sorry!"   Gotta love it how people jump to conclusions that with "just" 90 mods installed it must surely be Forge at fault.
    • XenoPyax
      I can't find any guide or wiki docs

      By XenoPyax · Posted 59 minutes ago

      Ah okay thanks
  • Topics

    • Sr_endi
      2
      [1.16.4]How to set the light value of an block

      By Sr_endi
      Started 19 hours ago

    • arkeN
      48
      Failure message: Missing License Information in file Mod File

      By arkeN
      Started October 11, 2020

    • e2rifia
      1
      (1.16.2) How do I use onPlayerTick?

      By e2rifia
      Started 1 hour ago

    • PotatoEz1
      4
      7 FPS with a GT 1030 + i5-4690 (1.16.3)

      By PotatoEz1
      Started 3 hours ago

    • XenoPyax
      2
      I can't find any guide or wiki docs

      By XenoPyax
      Started 1 hour ago

  • Who's Online (See full list)

    • Angercraft
    • FreshMod
    • GreenBerry
    • Sr_endi
    • Aecht_Rob
    • kiou.23
    • Ironhead_
    • XenoPyax
    • Ronshark
  • 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