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: Making a UnAnchored model float?

Previous Thread :: Next Thread 
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 08:00 PM
Hey, so i'm using CFrame to rotate an unanchored model... But the problem is the model is suppose to kinda just float in place and not really move accept for the brick that controls/rotates it. How can I make it just float? Would it be a bodyposition thing?
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 08:21 PM
Bump[1]
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
15 May 2015 08:31 PM
Yes.
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
15 May 2015 08:32 PM
Hey Cold :D

I think you can use a body force for this
I am semi asking the same question
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 08:37 PM
Ah cheers future lol ;3
Report Abuse
BattleFieldPwner is not online. BattleFieldPwner
Joined: 05 May 2013
Total Posts: 233
15 May 2015 08:39 PM
Cold so you want the brick to just float in place? or follow you while floating?
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
15 May 2015 08:42 PM
hopefully my question's answer will help :3
http://www.roblox.com/Forum/ShowPost.aspx?PostID=162211007
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
15 May 2015 08:44 PM
When you want to make a zero gravity model, make sure you add up the total mass of ALL the parts within the model. If you have models within models, you can use a recursive function to access the children of children (and more).
Report Abuse
BattleFieldPwner is not online. BattleFieldPwner
Joined: 05 May 2013
Total Posts: 233
15 May 2015 08:49 PM
Sup.



-Le problem is that you are not focusing- KEEP TRYINGGG
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 08:57 PM
Just float in place
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 09:02 PM
So Ray, how would I get the mass of everything inside one model, then put it in a bodyforce to make it stay in place?
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
15 May 2015 09:21 PM
local total = 0
for _,k in pairs (model:children()) do
total = total + k:GetMass()
end
force = Vector3.new(0,196.2*total,0)
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 09:28 PM
Returns with:

:GetMass() is not a valid member of Model

Plus, inside the model. there are models, how would it calculate the mass of them too?
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
15 May 2015 09:30 PM
Recursion

local total = 0
function getTotalMass(obj)
for i, v in pairs(obj:GetChildren()) do
if v:IsA("BasePart") then
total = total + v:GetMass()
end
if #v:GetChildren() > 0 then
getTotalMass(v)
end
end
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
15 May 2015 09:31 PM
local total = 0
local function addmass(model)
for _,k in pairs (model:children()) do
if k.ClassName == "Model" then
addmass(k)
elseif k:IsA("BasePart") then
total = total + k:GetMass()
end
end
end

addmass(model)
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 09:43 PM
Ok I got it and it adds the mass.. New problem. Ship now floats up away from anything LOL! (Using future's)
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 09:56 PM
The BodyForce creation script looks like this:

local Force = Instance.new("BodyForce", game.Workspace.Titanic.BowMotor)
local total = 0
local function addmass(model)
for _,k in pairs (model:children()) do
if k.ClassName == "Model" or k.ClassName == "Split" then
addmass(k)
elseif k:IsA("BasePart") then
total = total + k:GetMass()
Force.force = Vector3.new(0,196.2*total,0)
end
end
end
addmass(game.Lighting.Titanic)
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
15 May 2015 10:07 PM
local Force = Instance.new("BodyForce", game.Workspace.Titanic.BowMotor)
local total = 0
local function getTotalMass(obj)
for i, v in pairs(obj:GetChildren()) do
if v:IsA("BasePart") then
total = total + v:GetMass()
end
if #v:GetChildren() > 0 then
getTotalMass(v)
end
end
getTotalMass(game.Workspace.Titanic)
Force.force = Vector3.new(0,(196.2*total), 0)

If a force is acting on it from underneath and pushing it upwards, or it's getting pushed upwards in anyway for that matter, it's going to continue going upwards. Now I don't necessarily know what the problem is, but you should be taking the mass from the workspace titanic in case of any inconsistency.
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 10:19 PM
Hmmm... Still going up instead of floating in place.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
15 May 2015 10:34 PM
function ModelMass(m)
local mass = 0
for i,v in pairs(m) do
if m:IsA("BasePart") then
mass = mass + v:GetMass()
end
mass = mass + ModelMass(v)
end
return mass
end
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
15 May 2015 10:44 PM
Or you could use BodyPosition.
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 May 2015 10:46 PM
Would BodyPosition allow for the model to continue to be rotated using CFrame after?
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 May 2015 12:50 AM
Bump[2]
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
16 May 2015 01:22 AM
BodyPosition to hold the part in place,
BodyGyro to maintain a CFrame (or rotation in your case).
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 May 2015 01:57 AM
When I put them both in, the model just tipped over to the side? How can I make it stay flat?
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