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: Model rotation unsure.

Previous Thread :: Next Thread 
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
26 Sep 2015 01:59 PM
So my goal here is I've made a tool that creates buildings/barricades. When you equip the tool a dummy prop barricade follows your mouse around the screen using mouse.Hit.P

works good, then I added in rotation press 'R' to rotate the dummy model. My issue is I can press R and it rotates 90 degrees which works but when you click the mouse button my script is supposed to create the real model and goes to the position of the dummy model which works but I can't seem to get the right system for matching the same rotation as the dummy model. What should I do?


barricade = game.ReplicatedStorage.DummyBarricade:Clone()

local p = game.ReplicatedStorage.Barricade:Clone()
-- for loop rotates 90 degrees
for i = 1,90,1 do
barricade:SetPrimaryPartCFrame(CFrame.new(barricade.PrimaryPart.Position)*CFrame.Angles(0,i,0))
wait()
end


-- attempt to match the same rotation as the dummy model

p:SetPrimaryPartCFrame(CFrame.new(p.PrimaryPart.Position)*CFrame.Angles(0,barricade.PrimaryPart.Rotation.Y,0))
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
26 Sep 2015 02:02 PM
local rot = barricade.PrimaryPart.Rotation*math.pi/180
p:SetPrimaryPartCFrame(CFrame.new(p.PrimaryPart.Position)*CFrame.Angles(rot.X, rot.Y, rot.Z))
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
26 Sep 2015 02:11 PM
Thanks man!
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
26 Sep 2015 02:12 PM
I figured there must of been some equation for this.
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