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: Angles in CFrame

Previous Thread :: Next Thread 
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
04 Mar 2014 11:31 AM
I wan't a Brick to have the same angles as my Torso, what's wrong with this line??

gearmain.CFrame = CFrame.new(0,0,0) * Torso.CFrame.Angles


("Torso" is a variable)
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
04 Mar 2014 11:33 AM
Where is Torso coming from? you have to do something like:

workspace.Player1.Torso.CFrame.Angles

--and for gearmain

workspace.gearmain.CFrame
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
04 Mar 2014 11:34 AM
Sorry, Just realized at the bottom you said Torso is a variable, but make sure when you declare the variable it uses the same method
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
04 Mar 2014 11:37 AM
This is just one line in my script, here is the full script

--[Credits to hansotto for making this]--

Player = game.Players.hansotto
Character = Player.Character
Torso = Character.Torso

--[Gear]--
local gearmain = Instance.new("Part", Workspace)
gearmain.Position = Torso.Position + Vector3.new(0,6,0)
gearmain.CFrame = CFrame.new(0,0,0) * Torso.CFrame.Angles
gearmain.Size = Vector3.new(2,2,1)
gearmain.TopSurface = "Smooth"
gearmain.BottomSurface = "Smooth"
gearmain.Anchored = true
gearmain.Name = "Gear"
----------

--[MainLoop]--

while true do
Workspace.Gear.Position = Torso.Position + Vector3.new(0,6,0)
wait()
ends

--------------
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
04 Mar 2014 11:40 AM
Are you trying to get it in the middle? if not, it's this "CFrame.new(0,0,0)", change it to "CFrame.new(Torso.CFrame.p)".
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
04 Mar 2014 11:42 AM
to get it to be rotated in the same direction

thing.CFrame = CFrame.new(Torso.Rotation)
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
04 Mar 2014 11:42 AM
Why CFrame.p?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
04 Mar 2014 11:46 AM
nvm what I said,i made a huge mistake..
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
04 Mar 2014 11:47 AM
rot = Workspace.Part2.Rotation
Workspace.Part.CFrame = CFrame.new(0,2,0)*CFrame.Angles(math.rad(rot.X),math.rad(rot.Y),math.rad(rot.Z))
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
04 Mar 2014 11:49 AM
@hansotto

CFrame.p returns the position in a Vector3 I believe, if you just did "CFrame.new(Torso.CFrame)" it would cause an error since it's a CFrame in a CFrame and want to CFrame a Vector3.

Or you could just do "gearmain.CFrame = Torso.CFrame"
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
04 Mar 2014 11:51 AM
So "gearmain.CFrame = Torso.CFrame" will make the brick spin around itself when I spin around myself?
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
04 Mar 2014 11:58 AM
It should, try it out.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
04 Mar 2014 12:00 PM
why doesn't anyone ever use welds..??

w = Instance.new("Weld",gearmain)
w.Part0 = w.Parent
w.Part1 = Torso
w.C0 = CFrame.new(0,0,-1)*CFrame.new(0,0,math.pi)
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
04 Mar 2014 12:01 PM
Because might not want it to be attached to the player, maybe just having the same angles as the player...
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
04 Mar 2014 12:02 PM
It works, but whenever i run it, it makes two blocks? why??

--[Credits to hansotto for making this]--

Player = game.Players.hansotto
Character = Player.Character
Torso = Character.Torso

--[Gear]--
local gearmain = Instance.new("Part", Workspace)
gearmain.Position = Torso.Position + Vector3.new(0,6,0)

gearmain.Size = Vector3.new(2,2,1)
gearmain.TopSurface = "Smooth"
gearmain.BottomSurface = "Smooth"
gearmain.Anchored = true
gearmain.Name = "Gear"
----------

--[MainLoop]--

while true do
Workspace.Gear.Position = Torso.Position + Vector3.new(0,6,0)
gearmain.CFrame = Torso.CFrame
wait()
end

--------------
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
04 Mar 2014 12:24 PM
Fixed it.
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