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
 

How to set CFrame position but not rotation.

Previous Thread :: Next Thread 
chaokid9 is not online. chaokid9
Joined: 29 Aug 2008
Total Posts: 6187
06 Sep 2013 12:27 PM
I have a scirpt like this: Part.CFrame = mouse.Hit
But that sets the rotation too, and mouse.Hit rotation is really wierd. So anyway I can just set the Cframe position to mouse.Hit?
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
06 Sep 2013 12:30 PM
part.CFrame = CFrame.new(mouse.Hit.p)
Report Abuse
chaokid9 is not online. chaokid9
Joined: 29 Aug 2008
Total Posts: 6187
06 Sep 2013 12:41 PM
Thanks!
Report Abuse
chaokid9 is not online. chaokid9
Joined: 29 Aug 2008
Total Posts: 6187
06 Sep 2013 01:04 PM
Well, that kind of worked but there is a problem. Now instead of keeping the old rotation it resets the rotation to 0. Is there anyway to fix this?
Report Abuse
chaokid9 is not online. chaokid9
Joined: 29 Aug 2008
Total Posts: 6187
06 Sep 2013 01:30 PM
Got it fixed. Here it is for anybody wondering:
local x, y, z = script.Object.Value.Parent.MainPart.CFrame:toEulerAnglesXYZ()
-----------The rest of the script
script.Object.Value.Parent.MainPart.CFrame = CFrame.Angles(x,y,z) + (mouse.hit.p + Vector3.new(0,0.5,0))
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