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: Help with rotation?

Previous Thread :: Next Thread 
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 10:47 PM
I've been trying to figure this out but nothing I tried worked so far. I just want to know how to rotate a part to a direction that another part is facing, not 3D but 2D like a compass where it only rotates to the left or right, like in this picture where the light grey part is the one that rotates where the dark grey part is facing prntscr /c9nfwh


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 10:49 PM
local _,_,_,_,_,comp = SomeCFrame:components()
print(math.deg(math.asin(comp)))
this is the Y (guestimate)
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 10:54 PM
local _,_,_,_,_,comp = script.Parent.asd.CFrame:components()
script.Parent.SmokeParticle.CFrame = CFrame.new(script.Parent.SmokeParticle.CFrame.p,Vector3.new(0,math.deg(math.asin(comp)),0))

I did this and it's pointing in a completely random direction prntscr /c9nihm


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 10:56 PM
cframe R02 is math.sin(math.rad(Y))
so
math.deg(math.asin(Y)) is the DEGREES OF Y
to get radians do math.asin(Y)
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 10:57 PM
and what you dont seem to understand is what CFrame.new() will do with 2 Vector3s

giving it 2 Vector3s makes a CFrame from the 1st one looking towards the 2nd
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:06 PM
#################################################################################################################################################################################################################################################################################################################################################################
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:07 PM
#################################################################################################################################################################################################################################################################################################################################################################################################
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:07 PM
###################################################################################################################################################################################################################################################################################################################################################################################################
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:08 PM
################################################################################################################################################################################################################################################################################################################################################
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:09 PM
WHAT THE HELL!?!!?


Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:10 PM
local _,_,_,_,_,comp = script.Parent.asd.CFrame:components()
script.Parent.SmokeParticle.CFrame = CFrame.new(script.Parent.SmokeParticle.CFrame.p)
script.Parent.SmokeParticle.Rotation = Vector3.new(0,math.deg(math.asin(comp)),0)


Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:10 PM
###################################################################################
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:11 PM
oh my god


Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:12 PM
while wait() do
local _,_,_,_,_,comp = script.Parent.asd.CFrame:components()
print(math.deg(math.asin(comp)))
script.Parent.SmokeParticle.CFrame = CFrame.new(script.Parent.SmokeParticle.CFrame.p)
script.Parent.SmokeParticle.Rotation = Vector3.new(0,math.deg(math.asin(comp)),0)
end

SO I DID THAT AND IT WORKS, BUT ONCE I ROTATE IT PAST 90 OR -90 DEGREES IT STARTS GOING BACKWARDS STOP HASHTAGGING THE SCRIPT OMGGGGG


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 11:15 PM
because you dont edit rotation
rotation sux

use CFrame

also you can use toEulerAnglesXYZ
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:25 PM
Did this and it's the same thing :/

while wait() do
local _,_,_,_,_,comp = script.Parent.asd.CFrame:components()
script.Parent.SmokeParticle.CFrame = CFrame.new(script.Parent.SmokeParticle.CFrame.p) * CFrame.Angles(0,math.asin(comp),0)
end


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 11:33 PM
^

>>"also you can use toEulerAnglesXYZ"
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
23 Aug 2016 11:36 PM
cant you do

local target = pos
local me = me

me.CFrame = CFrame.new(me.Position,Vector3.new(target.X,me.Position.Y,target.Z))
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 11:37 PM
they said they want a compass
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
23 Aug 2016 11:37 PM
Yeah, seriously, idk what blarg is trying to do.


Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:38 PM
Same thing...

while wait() do
local x, y, z = script.Parent.asd.CFrame:toEulerAnglesXYZ()
script.Parent.SmokeParticle.CFrame = CFrame.new(script.Parent.SmokeParticle.CFrame.p) * CFrame.Angles(0,y,0)
end


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 11:39 PM
look at freemodels then idk lol
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:41 PM
while wait() do
script.Parent.SmokeParticle.CFrame = CFrame.new(script.Parent.SmokeParticle.Position,Vector3.new(script.Parent.asd.Position.X,script.Parent.SmokeParticle.Position.Y,script.Parent.asd.Position.Z))
end

doing this just puts SmokeParticle at 0, -340282346638528859811704183484516925440, 0


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
23 Aug 2016 11:42 PM
try this

part.CFrame = asd.CFrame
part.CFrame = CFrame.new(part.CFrame.p,part.CFrame.p + part.CFrame.lookVector*Vector3.new(9,0,9))


put both
Report Abuse
Evolution_Theory is not online. Evolution_Theory
Joined: 03 Feb 2012
Total Posts: 1770
23 Aug 2016 11:45 PM
That worked! Thank you :)


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