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: CFrame rotation around an axis

Previous Thread :: Next Thread 
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Jun 2013 07:33 PM
I want "grass" to rotate around the Y-axis, basically exactly the same way a carousel would rotate around its axis.
However this isnt doing the trick.

local ryr = math.random(-180,180)
grass.CFrame = CFrame.fromEulerAnglesXYZ(grass.CFrame.x, ryr, grass.CFrame.z)
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
14 Jun 2013 07:34 PM
grass.CFrame = grass.CFrame * CFrame.Angles(0,ryr,0)
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
14 Jun 2013 07:36 PM
grass.CFrame = grass.CFrame * CFrame.Angles(0, math.rad(ryr), 0)
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
14 Jun 2013 07:36 PM
If your talking about it going around and around and that this is in a loop then.....

local ryr = Instance.new("IntValue",game.Workspace)
grass.CFrame = CFrame.fromEulerAnglesXYZ(grass.CFrame.x, math.rad(ryr.Value+1), grass.CFrame.z)

But if you want what you just gave me then Ima guess...

local ryr = math.random(-180,180)
grass.CFrame = CFrame.fromEulerAnglesXYZ(grass.CFrame.x, math.rad(ryr), grass.CFrame.z)
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Jun 2013 07:36 PM
Still no.

Look, they are rotating around x and z axis weirdly,

puu.sh/3fUar.jpg


I want them to rotate on the same axis as a carousel would.

By the way that huge sphere is the bottom of the grass mesh
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
14 Jun 2013 07:37 PM
Are you replying to me because I made my post like a few seconds before yours.
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Jun 2013 07:39 PM
To cody, but your line did this:
puu.sh/3fUgq.jpg

see that grass ball below the baseplate?

its a huge rotating ball of grass that should be on the plate xD
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
14 Jun 2013 07:41 PM
Okay, put the CFrame to what you want:

local Part = Game.Workspace.Grass
local Cframe = CFrame.new(0, 0, 0)

for i = 1, 360 do
Part.CFrame = Cframe * CFrame.Angles(0, math.rad(i), 0)
end

And you could loop that if you want.
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Jun 2013 07:42 PM
This is basically the grass I want to rotate.
puu.sh/3fUm5.jpg

but with cody's line, it looks like this:
http://puu.sh/3fUar

with evolveds line like this:
http://puu.sh/3fUgq
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Jun 2013 07:44 PM
And its not in a loop it will only be positioned once
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
14 Jun 2013 07:45 PM
for _, Grass in pairs(Game.Workspace:GetChildren()) do
if Grass.Name == "Grass" then
Grass.CFrame = Grass.CFrame * CFrame.Angles(0, math.rad(math.rad(-180, 180), 0)
end
end
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
14 Jun 2013 07:46 PM
CFrame.Angles(0, math.rad(math.rad(-180, 180), 0)
to
CFrame.Angles(0, math.rad(math.random(-180, 180)), 0)
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
14 Jun 2013 07:46 PM
Thanks cody!
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