of     1   

mattscy
#228174357Tuesday, November 28, 2017 2:10 AM GMT

how would you determine the face of the part the mouse is hovering over, despite the rotation of that part? so if you had a part and you hovered over one of the sides, it would print "Front" and then if you rotated the part 90 degrees and then hovered over the new face that is on the same side, it would still print "Front"
Soybeen
#228175329Tuesday, November 28, 2017 2:28 AM GMT

You could take the magnitude from each of the face centers - mouse.Hit.p Alternatively you could cast that hits the face, and return its normal, then compare that normal with the upVector,-upVector,lookVector,-lookVector,rightVector,-rightVector and see which one it's closest to (or matches)
KapKing47
#228176004Tuesday, November 28, 2017 2:43 AM GMT

NormalId TargetSurface [readonly] The side of the instance that the mouse is pointing to. http://wiki.roblox.com/index.php?title=API:Class/Mouse No need for raycasting Soy.
Soybeen
#228176306Tuesday, November 28, 2017 2:50 AM GMT

Niiiiice. I'm used to determining this without a mouse.
KapKing47
#228176584Tuesday, November 28, 2017 2:56 AM GMT

Yeah lol. Good for practice too :D But for beginners the mouse can be of assistance.
Soybeen
#228177206Tuesday, November 28, 2017 3:08 AM GMT

Only potential downside to using this parameter of the mouse that I can see is if you need to verify it on the server, and it's something that should be secure. In all likelihood, for you, it's not.
Soybeen
#228177255Tuesday, November 28, 2017 3:09 AM GMT

using this property*
mattscy
#228180755Tuesday, November 28, 2017 4:39 AM GMT

i am aware of targetsurface, but that returns the surface relative to the parts rotation what i need is a way to determine which face on the part is facing north, south, east, west etc. despite the rotation for example, using targetsurface, if you hover over the front of the part it says Front then when you rotate it 90 degrees the surface that is now facing in that direction would be the Right but i want it so that both times, no matter what the rotation, the surface thats pointing in that direction (or closest to that direction) will print as front
128Gigabytes
#228181264Tuesday, November 28, 2017 4:57 AM GMT

well if you rotate the part its no longer the front so?
mattscy
#228181605Tuesday, November 28, 2017 5:12 AM GMT

it would be the front in world space
Soybeen
#228185938Tuesday, November 28, 2017 10:19 AM GMT

If you are trying to determine which face of a part is most facing north (or any direction), you would supplement the worldly direction's unitvector and each of the part's face's unitvectors until you find the closest into this function that determines the angle between two vectors: math.acos(a:Dot(b))
mattscy
#228186336Tuesday, November 28, 2017 10:58 AM GMT

so far i have this, although when i print all of them out they are either 0 or half of pi local north = Vector3.new(0,0,1) local front = math.acos(mouse.Target.CFrame.lookVector:Dot(north)) local back = math.acos(-mouse.Target.CFrame.lookVector:Dot(north)) local right = math.acos(mouse.Target.CFrame.rightVector:Dot(north)) local left = math.acos(-mouse.Target.CFrame.rightVector:Dot(north)) local up = math.acos(mouse.Target.CFrame.upVector:Dot(north)) local down = math.acos(-mouse.Target.CFrame.upVector:Dot(north)) what am i doing wrong?
Soybeen
#228186459Tuesday, November 28, 2017 11:07 AM GMT

Could the issue be your order of operations? local back = math.acos(-mouse.Target.CFrame.lookVector:Dot(north)) versus local back = math.acos((-mouse.Target.CFrame.lookVector):Dot(north))
mattscy
#228186528Tuesday, November 28, 2017 11:13 AM GMT

still doesnt work also tried north:Dot(mouse.Target.CFrame.lookVector) but that doesnt seem to work either
KapKing47
#228339561Saturday, December 02, 2017 7:11 PM GMT

1. Show us the 'if' statements. 2. Dot product is commutative, meaning that either way the result will be the same as the function simply returns #### # #### + v1.Y * v2.Y + v1.Z * v2.Z.
Quasiduck
#228342894Saturday, December 02, 2017 8:13 PM GMT

(-a).b == (a).(-b) == -(a.b) So that isn't the issue. "so far i have this, although when i print all of them out they are either 0 or half of pi" Angle of 0 means the vectors are parallel... Angle of half of pi means they are perpendicular. I'm not entirely sure what you want but, if you're looking for a way to determine which surface is the closest to facing that direction of Vector3.new(0,0,1)... Use this; https://forum.roblox.com/Forum/ShowPost.aspx?PostID=227496670 Once you get the code for the function up, replace Vector3.new(0,1,0) with Vector3.new(0,0,1).
Quasiduck
#228342958Saturday, December 02, 2017 8:15 PM GMT

Woops... I meant, replace each .y with a .z (There are two of them.)
Quasiduck
#228343076Saturday, December 02, 2017 8:17 PM GMT

Basically... the one that produces an angle of 0 is parallel to the vector (0,0,1). It is the equivalent of testing each face and seeing which dot product value is the closest to 1. (As acos(1) == 0)

    of     1