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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: @rvox, get in here.

Previous Thread :: Next Thread 
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
16 Feb 2016 06:56 PM
Title is just because I need people who know what they're doing with CFrame.

I need to move a model by its center of it bounding box. I've been struggling with this for days, please help.

#code while wait(1) and x > madness do x = x - 0.01 end
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 06:57 PM
Model:TranslateBy()
Report Abuse
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
16 Feb 2016 06:59 PM
Doesnt work for what im doing.

#code while wait(1) and x > madness do x = x - 0.01 end
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
16 Feb 2016 06:59 PM
u could always use GetModelCFrame() and SetPrimaryPartCFrame()

ill do it without primary part if u insist


Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 06:59 PM
And why's that? You want to move it from it's center, and that does exactly what you want.
Report Abuse
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
16 Feb 2016 07:02 PM
Translate moves it, it doesnt give me any position information. How can I do this without without a primary part?

#code while wait(1) and x > madness do x = x - 0.01 end
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 07:04 PM
What do you mean position information? What is wrong with you? If you need to move it from the center, this is EXACTLY what you want. Model:TranslateBy(amnt)
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
16 Feb 2016 07:18 PM
function MoveModel(model,cf)
local mcf = model:GetModelCFrame()
local function search(t)
for i=1,#t do
if t[i]:IsA("BasePart") then
local o = mcf:inverse()*t[i].CFrame
print(o.p)
t[i].CFrame = cf*o
end
search(t[i]:GetChildren())
end
end
search(model:GetChildren())
end

works as far as I can see

Unstable's solution might be suitable, but it uses Vector3s and I believe that the function will be aware of collisions

Mine can be a little expensive though, so don't plan on running it a lot


Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 07:20 PM
@rvox

I was under the impression that it wouldn't. Let me run a quick test.
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
16 Feb 2016 07:22 PM
Actually it ignores collisions

nonetheless, it does not use CFrames


Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 07:23 PM
I was aware of that (that it doesn't use CFrame).

Anyways, it seems collisions don't register. However, I had a weird effect. Somehow, it collided 0.5 studs into the part above it (or should have), but instead they BOTH rose 0.5 studs. Quite odd.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
16 Feb 2016 07:28 PM
Less expensive 4 u

local function MoveModel(model,cf)
cf = cf*model:GetModelCFrame():inverse()
local temp = model:GetChildren()
for _, obj in ipairs(temp) do
if obj:IsA("BasePart") then
obj.CFrame = cf*obj.CFrame
end
for _, child in ipairs(obj:GetChildren()) do
temp[#temp+1] = child
end
end
end
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
16 Feb 2016 07:34 PM
wtf i did not know tht method to serch thru everything


Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
16 Feb 2016 07:36 PM
ipairs is so bad... use next.

for i,v in next, table do
-- stuff
end



#code R+ | local RAP = "R$423,184"; local robux = "R$13,865"
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
16 Feb 2016 07:37 PM
abstract dont start tht argument

numerical loops > all


Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
16 Feb 2016 07:38 PM
LOL but rly next > all

numerical loops r just rly bad because the thing ur looping thru isnt already defined... u gotta do tbl[i] which looks horrid... get back to 2016, not 2011 jfc



#code R+ | local RAP = "R$423,184"; local robux = "R$13,865"
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
16 Feb 2016 07:39 PM
It's magical. No need for extra function calls//scoped function creation. Also is a better choice to recursion (in this instance) as Roblox doesn't support tail calls which means you can cause a stack overflows via recursive functions.
Report Abuse
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
16 Feb 2016 07:56 PM
Ughhh.... Oh my god, thanks rvox and casual. You guys typically pull through for me. Explain why that works so I don't have to figure it out on my own? ::))
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 07:59 PM
No thanks for me, when even rvox said it works? Just wow, wow. Your an ungrateful child.
Report Abuse
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
16 Feb 2016 07:59 PM
CFrame is what I need a explain action of. Also nice recursion meow casual
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
16 Feb 2016 07:59 PM
It still works, regardless of whether it takes Vector3's or CFrames.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
17 Feb 2016 02:33 AM
>> It still works, regardless of whether it takes Vector3's or CFrames.

While your solution doesn't error and therefore meets the minimum definition of working, it is not comparable to posted and accepted solution since it cannot handle rotation and by your own admittance isn't 100% reliable (i.e weird effect).


>>No thanks for me, when even rvox said it works? Just wow, wow. Your an ungrateful child.

OP specifically wanted to move things via CFrame. We provided the appropriate CFrame transformation function. You provided a Vector3 translation function (merely quoted the API), which OP probably already looked at when researching the problem.


OP is not an ungrateful child, as evinced by OPs expression of gratitude for the solution they were looking for. Your solution just wasn't what they wanted, move on.
Report Abuse
checkplate is not online. checkplate
Joined: 05 Jan 2016
Total Posts: 1379
17 Feb 2016 06:15 AM
> What do you mean position information? What is wrong with you?

Lol, translate by doesn't work because of what I'm doing. I need to be able to move models to very specific points for 3D guy tiling and translate by doesn't work. If this isn't already obvious to you, translate by doesn't work because the origin as well as the position of models in ReplicatedSotrage vary slightly which doesn't turn out good when tiling.

Drop the attitude skid, you're not cnt don't think you can act like cnt.
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
17 Feb 2016 06:18 AM
There is only one cnt, and he does not share power.


Report Abuse
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
17 Feb 2016 06:18 AM
IDK what this thread is for. So I'm just going to start a chain.

^
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