generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How can I get a direct path to an object?

Previous Thread :: Next Thread 
Riderj is not online. 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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 09:43 PM
Lerp?
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
16 Jan 2012 09:46 PM
^
Report Abuse
Riderj is not online. 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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 09:50 PM
Vector3:Lerp()?
Report Abuse
blockoo is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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 is not online. 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 is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
16 Jan 2012 09:50 PM
@AFF
Y...U...camelCase?!?!?!
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 09:51 PM
"linear interpolation"?!?

I'd better Google that.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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 is not online. 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 is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
16 Jan 2012 09:53 PM
What about rotations?
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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 is not online. 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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 09:58 PM
Are you typing these on the spot?
Report Abuse
Riderj is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 09:59 PM
They didn't use "coarse language".
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image