Results 1 to 6 of 6
- 08-22-2012, 05:12 AM #1
Member
- Join Date
- May 2012
- Posts
- 11
- Rep Power
- 0
-
Re: Smooth rotation to a desired direction
I can't imagine that we're going to be able to help you much based on this post above as it is way too short on details. Care to show us what you've tried so far? Can you give us a little context? Is this using BufferedImages and Graphics2D, JOGL graphics? Something completely different? Where specifically are you stuck? Come on, please help us out here.
- 08-22-2012, 05:31 AM #3
Member
- Join Date
- May 2012
- Posts
- 11
- Rep Power
- 0
Re: Smooth rotation to a desired direction
sorry, I am using BufferedImages and Graphics2D. I can rotate the image, I just need help getting the rotation smooth. I have tried to have the Image rotate a certain amount every update towards the goal rotation like this:
This doesn't compensate for the gap between 0 and 360, and the rotation doesn't have momentum so I am not happy with it.Java Code:if(currentrotation>desiredrotation)currentrotation-=1; else currentrotation+=1;
-
Re: Smooth rotation to a desired direction
You have to expect discrete results when you use ints and degrees. Instead use a double variable and radians in your rotation matrix, and use a rotation step of < 1 degree (equivalent to Math.PI / 180 in radians). I assume that you're using an AffineTransform for your rotation. Play with your code and you'll likely smooth things out.
- 08-22-2012, 05:40 AM #5
Member
- Join Date
- May 2012
- Posts
- 11
- Rep Power
- 0
Re: Smooth rotation to a desired direction
Ok, thanks for the tips
- 08-22-2012, 09:17 AM #6
Similar Threads
-
Need help. I am not able to get the desired display of output in my program.
By pcmechanic in forum New To JavaReplies: 1Last Post: 02-13-2012, 02:51 PM -
How to scale an image to desired size?
By asifzbaig in forum AWT / SwingReplies: 4Last Post: 06-26-2011, 09:07 PM -
displaying a desired out put
By Cubswin in forum New To JavaReplies: 3Last Post: 03-13-2011, 06:05 AM -
Integer negation does not give the desired result.
By XdaX in forum Advanced JavaReplies: 20Last Post: 10-21-2009, 03:59 PM -
smooth-scroll
By designer in forum Java AppletsReplies: 1Last Post: 07-21-2009, 07:10 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks