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 » Scripters
Home Search
 

Re: TweenPosition/TweenSize for Vectors?

Previous Thread :: Next Thread 
AlphaPrism is not online. AlphaPrism
Joined: 12 Apr 2011
Total Posts: 5290
08 May 2014 01:44 PM
You can already use TweenPosition for Frames and other Gui-related Objects.

Example:
game.StarterGui.TestGui.Frame:TweenPosition(UDim2.new(1,1,1))

There is also TweenSize.
game.StarterGui.TestGui.Frame:TweenSize(UDim2.new(1,1,1))

If these were able to move Non-Gui Objects(Parts/Models) it would be very useful.

For example, The script would look something like this:

game.Workspace.Part:TweenSize(Vector3.new(1,1,1))

or

game.Workspace.Part:TweenPosition(Vector3.new(1,1,1))

- So, what do you think?
Report Abuse
AlphaPrism is not online. AlphaPrism
Joined: 12 Apr 2011
Total Posts: 5290
08 May 2014 01:45 PM
- Bump

[Any Replies]

[[Someone Reply]]
Report Abuse
AlphaPrism is not online. AlphaPrism
Joined: 12 Apr 2011
Total Posts: 5290
08 May 2014 03:54 PM
Maybe one last bump..
Report Abuse
VirtualPrince is not online. VirtualPrince
Joined: 17 Oct 2013
Total Posts: 7386
08 May 2014 03:58 PM
No you a loop for that, tweening is for GUI only.
Report Abuse
AlphaPrism is not online. AlphaPrism
Joined: 12 Apr 2011
Total Posts: 5290
08 May 2014 04:01 PM
Aww.
Report Abuse
VirtualPrince is not online. VirtualPrince
Joined: 17 Oct 2013
Total Posts: 7386
08 May 2014 04:04 PM
It's a relatively good idea, but sadly there is no method that I know of.
Report Abuse
AlphaPrism is not online. AlphaPrism
Joined: 12 Apr 2011
Total Posts: 5290
08 May 2014 04:09 PM
This is an idea. I didn't post it in S&I cause few people will know what I'm on about.
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
08 May 2014 06:45 PM
We basically have this - Vector3 lerp.

function TweenPos(part, endp, time_s)
local start = part.Position
for i = 1, time_s*60 do
part.Position= start:Lerp(endp, i/(time_s*60))
wait(1/60)
end
end
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
09 May 2014 08:23 AM
"wait(1/60)"

Why do this if scripts run every 1/30th. of a second?
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
12 May 2014 02:28 AM
Actually, wait(1/60) is implemented now, as roblox has increased from 30Hz to 60Hz. To wait one frame (1/60) you need to explicitly wait for that, otherwise some games will work "twice as fast"
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
12 May 2014 05:30 AM
Which is also why you shouldn't do that. It's inconsistent. And you also shouldn't be changing the position. Here's how you do it properly:

function tween(part, B, time, f)
local A = part.Position
local t = 0
while t < 1 do
t = math.min(t + wait(1/60)/time, 1)
part.CFrame = (part.CFrame - part.CFrame.p) + A:lerp(B, f(t))
end
end

And then you call it like:

tween(workspace.Part, Vector3.new(0, 50, 0), 5, function(x) return x*x end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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