|
| 24 Jul 2012 08:36 PM |
Hey guys. I'm unbanned now.
Anyways, I was looking at some realistic car models and noticed that plenty of them had a speed label but not a speedometer.
What I want to know is, is this possible? To make a needle point left or right but keep its position (2D).
If so, how do you accomplish this? I want to move away from images and use something more dynamic such as a frame with a red background color.
I imagine this will be easier with Sorcus's GUI rotation, but until then, is there a workaround?
- Techboy6601, eater of donuts |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 24 Jul 2012 08:58 PM |
| How do you make lines? Is it some specific RbxGui feature? |
|
|
| Report Abuse |
|
|
um3k
|
  |
| Joined: 28 Feb 2008 |
| Total Posts: 189 |
|
|
| 24 Jul 2012 09:08 PM |
Hint: A line is a narrow rectangle.
Hint 2: Frames are rectangles. |
|
|
| Report Abuse |
|
|
| |
|
um3k
|
  |
| Joined: 28 Feb 2008 |
| Total Posts: 189 |
|
|
| 24 Jul 2012 09:19 PM |
Oh, wait, you need it to pseudo-rotate. You'll need to make it out of multiple square frames and position them at intervals along the line defined by Oysi's script.
You can create a bunch of frames with a for loop, and store them in a table. Then iterate through them on each update, setting the position to an appropriate Lerp (I presume this would be faster than multiple trigonometric calculations) between the midpoint and Oysi's script. It'll be a bit jagged, but it should work. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2012 09:28 PM |
| I suggest you just use a label to tell the speed for now. When they'll release GUI rotation, then you'll update it to use GUI rotation. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 12:00 AM |
"local speed = 50 -- speed of your vehicle local top = 200 -- speed when the needle points directly to the right
local t = -math.pi + speed/top*math.pi
local x = math.cos(t)/2 local y = math.sin(t)/2
Now update/create a line from (0.5, 0.5) to (x, y) in scale coordinates.
I think that should work. =)"
umg thats the first oysi magic that i actually understand |
|
|
| Report Abuse |
|
|
Combrad
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 11025 |
|
|
| 25 Jul 2012 02:10 AM |
I'd create all the frames first. Then calculate there positions, rather than just reinstancing them each time. |
|
|
| Report Abuse |
|
|