|
| 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 |
|
|
|
| 23 Aug 2016 10:49 PM |
local _,_,_,_,_,comp = SomeCFrame:components() print(math.deg(math.asin(comp))) this is the Y (guestimate) |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 23 Aug 2016 11:06 PM |
| ################################################################################################################################################################################################################################################################################################################################################################# |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2016 11:07 PM |
| ################################################################################################################################################################################################################################################################################################################################################################################################# |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2016 11:07 PM |
| ################################################################################################################################################################################################################################################################################################################################################################################################### |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2016 11:08 PM |
| ################################################################################################################################################################################################################################################################################################################################################ |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 23 Aug 2016 11:10 PM |
| ################################################################################### |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 23 Aug 2016 11:15 PM |
because you dont edit rotation rotation sux
use CFrame
also you can use toEulerAnglesXYZ |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 23 Aug 2016 11:33 PM |
^
>>"also you can use toEulerAnglesXYZ" |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 23 Aug 2016 11:37 PM |
| they said they want a compass |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 23 Aug 2016 11:39 PM |
| look at freemodels then idk lol |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|