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: CFrame rotate part while keeping position

Previous Thread :: Next Thread 
haskjdfsask is not online. haskjdfsask
Joined: 08 Jun 2014
Total Posts: 810
05 Jan 2017 06:35 PM
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
while true do
local direction = CFrame.new(workspace.Part.Position, Mouse.hit.p)
list=workspace:GetChildren()
for i=1,#list do
if list[i].Name=="Part" then
list[i].direction
--list[i].CFrame=list[i].CFrame*direction
end
end
wait()
end

The script, as is right now, will rotate all objects in workspace named "Part" towards where the mouse is pointing, but it overrides their position. How do I keep the positions of the parts while rotating?
Report Abuse
Metexrr is not online. Metexrr
Joined: 29 Sep 2012
Total Posts: 135
05 Jan 2017 06:40 PM
part.CFrame = part.CFrame *CFrame.Angles(vec3val)


Report Abuse
haskjdfsask is not online. haskjdfsask
Joined: 08 Jun 2014
Total Posts: 810
05 Jan 2017 06:43 PM
^^
Thanks, but that made me realise I have to update direction.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
while true do
list=workspace:GetChildren()
for i=1,#list do
if list[i].Name=="Part" then
local direction = CFrame.new(list[i].Position, Mouse.hit.p)
list[i].CFrame=direction
end
end
wait()
end

works now, thanks
Report Abuse
Metexrr is not online. Metexrr
Joined: 29 Sep 2012
Total Posts: 135
18 Jan 2017 02:59 PM
happy to help :)


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