hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 24 May 2015 04:32 PM |
I need a way to convert a surface normal (Vector3) to Euler angles (CFrame.Angles).
The third return value of FindPartOnRay ( http://wiki.roblox.com/index.php?title=FindPartOnRay ) is the surface normal. If the part is rotated to 90 degrees, either X, Y, or Z will be 1.
This function gave inaccurate rotations:
local x, y, z = PartCF:toEulerAnglesXYZ() CFrame.new(PartCF.p, PartCF.p + SurfaceNormal)*CFrame.Angles(math.rad(x), math.rad(y), math.rad(z))
This function gave incorrect rotations:
CFrame.new(PartCF.p)*CFrame.Angles(math.rad(SurfaceNormal.X), math.rad(SurfaceNormal.Y), math.rad(SurfaceNormal.Z))
Can someone help please? |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 24 May 2015 04:33 PM |
Correction for 2nd function (that still didn't work:)
SurfaceNormal = SurfaceNormal*90 CFrame.new(PartCF.p)*CFrame.Angles(math.rad(SurfaceNormal.X), math.rad(SurfaceNormal.Y), math.rad(SurfaceNormal.Z)) |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
| |
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
| |
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 24 May 2015 08:33 PM |
somewhat unrelated: ew euler angles |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 08:38 PM |
| Like bullet holes? You can use the Sword of Earth limited item to see what it does. |
|
|
| Report Abuse |
|
|