Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 16 Jan 2012 09:42 PM |
I want to move an object back and forth between two points. How can I do such a thing? I was thinking about using magnitude, but I do not think it would work just right.
[Slap a saddle on and ride] |
|
|
| Report Abuse |
|
|
| |
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 16 Jan 2012 09:49 PM |
That makes no sense at all.
[Slap a saddle on and ride] |
|
|
| Report Abuse |
|
|
| |
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 16 Jan 2012 09:50 PM |
What do you mean?
http://wiki.roblox.com/index.php/Lerp#Methods |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:50 PM |
LERPING! NUUUUU I've not learned that.
function translate(part, newPoint, ratio, totalTime) ratio = type(ratio)=="number" and ratio<=1 and ratio>0 and ratio or 0.25 totalTime = type(totalTime)=="number" and totalTime or 1 local oldPos = part.Position for i = ratio, 1, ratio do part.Position = oldPos:lerp(newPoint, i) wait(ratio*totalTime) end part.Position = oldPos:lerp(newPoint, 1) end
-- EXAMPLE translate(workspace.Part, Vector3.new(50, 9, 22), 0.05, 2)
Good thing I know the jist of what linear interpolation does. :)
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 16 Jan 2012 09:50 PM |
Haha, could have explained it XD
[Slap a saddle on and ride] |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 16 Jan 2012 09:50 PM |
@AFF Y...U...camelCase?!?!?! |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:51 PM |
becauseEyeCan
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:51 PM |
"linear interpolation"?!?
I'd better Google that. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:52 PM |
That IS what lerp stands for .... XD
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 16 Jan 2012 09:53 PM |
@AFF
That is confusing haha, but guess I can study that :3
[Slap a saddle on and ride] |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
| |
|
|
| 16 Jan 2012 09:54 PM |
Please note: In less than 26 hours, the English Wikipedia will be blacked out globally in protest of SOPA and PIPA.
NOOOOOO...... |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:54 PM |
Rotations 4 nubz.
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:54 PM |
Yay, more organizations to protest SOPA and PIPA. :)
Senators and their tiny tiny brains these days.
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 16 Jan 2012 09:55 PM |
@Topic
Y U CONFUZE ME!
[Slap a saddle on and ride] |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:56 PM |
"Yay, more organizations to protest SOPA and PIPA."
Send them an angry letter, how much more effective can you get? |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:57 PM |
XD Here's another way:
function translate(part, newPoint, ratio, totalTime) ratio = type(ratio)=="number" and ratio<=1 and ratio>0 and ratio or 0.25 totalTime = type(totalTime)=="number" and totalTime or 1 local oldPos = part.Position local transVec = newPoint - oldPos for i = ratio, 1, ratio do part.Position = transVec*i + oldPos wait(ratio*totalTime) end part.Position = newPoint end
-- EXAMPLE translate(workspace.Part, Vector3.new(50, 9, 22), 0.05, 2)
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:58 PM |
| Are you typing these on the spot? |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 16 Jan 2012 09:58 PM |
I will try that :3
[~ The key to programming is understanding it, not memorizing it. ~] |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:58 PM |
"Send them an angry letter, how much more effective can you get?"
That explains why Google, Facebook, and Twitter didn't get the job done. They sent a letter.
Unless the DNS monitoring portion was removed BECAUSE of that letter .... But I doubt it.
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:59 PM |
"Are you typing these on the spot?"
Of course! You think I have a library of saved code?
I do, but it's for Script Builders, back when I was a complete noob. I keep them to remind me how far I've gotten over the past 4 years.
Cheers, -- AFF
If a man hasn't discovered something that he will die for, he isn't fit to live. ~MLK |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 09:59 PM |
| They didn't use "coarse language". |
|
|
| Report Abuse |
|
|