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: Model Rotation

Previous Thread :: Next Thread 
Harveer12121Alt is not online. Harveer12121Alt
Joined: 16 Jun 2011
Total Posts: 1967
15 Jul 2013 11:13 AM
I am trying to have a model rotate on its own, but there seems to be some problems.

Help?

brick = script.Parent.children.Rotation
while true do
wait(0.001)
brick.CFrame = brick.CFrame * CFrame.fromEulerAnglesXYZ(1,0,0)
end
Report Abuse
Harveer12121Alt is not online. Harveer12121Alt
Joined: 16 Jun 2011
Total Posts: 1967
15 Jul 2013 11:16 AM
Bump.
Report Abuse
Harveer12121Alt is not online. Harveer12121Alt
Joined: 16 Jun 2011
Total Posts: 1967
15 Jul 2013 11:18 AM
Bump2
Report Abuse
baheeg is not online. baheeg
Joined: 19 Jul 2010
Total Posts: 72846
15 Jul 2013 11:19 AM
[ Content Deleted ]
Report Abuse
DrOMG is online. DrOMG
Joined: 21 Oct 2007
Total Posts: 337
15 Jul 2013 11:22 AM
I just want to say that rotating a model is far more complicated than that, as far as I know, but I'd suggest making a primary part of the model controlled by a BodyGyro, meaning that the model would have to be Unanchored.
Report Abuse
Harveer12121Alt is not online. Harveer12121Alt
Joined: 16 Jun 2011
Total Posts: 1967
15 Jul 2013 11:22 AM
Not a scripting genius, so I have no idea, but meh.

children are just CornerWedges

rotation is the rotation of the CornerWedges

I bet you will laugh at what I posted, thinking this guy is an idiot.


I get that a lot in SH.

 
Report Abuse
DrOMG is online. DrOMG
Joined: 21 Oct 2007
Total Posts: 337
15 Jul 2013 12:30 PM
You're not an idiot, you're asking for help without the correct foreknowledge.

If you ever get negative criticism, just take the constructive parts away from it. Ignore the insults, they mean what you want them to mean.

As for scripting, I'd consult tutorials and the ROBLOX wiki for answers. I only go to SH for help on a specific problem I can't find anywhere else.

You can't necessarily find the children of a model by saying: model.children
It's an actual function which returns a table: model:GetChildren()

A table, in case you didn't know, is just a list of things. An example being:
local table = {"cat", "bat", "sat"}
print(table[2])

You'd receive "bat" in the output, as "bat" is the second part of the table. The same works for object values, as model:GetChildren() returns every object in the model.

Unfortunately, applying the same rotation to every object wouldn't work so well, as you'd just see every part in it's original spot pointing in another direction. I have no good idea on rotating a model, but my guess would be along the lines of:

local c = model:GetChildren()
local base = c[1]
local theta = 2*math.pi*(50/360) -- 50 Degrees to Radians conversion
for i = 1, #c do
local dis = (c[i].Position-base.Position).magnitude
c[i].CFrame = CFrame.new(dis*math.cos(theta),0,dis*math.sin(theta))*CFrame.formEulerAnglesXYZ(0,theta,0)
end

Yeah, I know it looks complicated. I also doubt it'd work but I was just playing around. Basically it takes one part, and bases the rotation around that one part with the circle equation.
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