badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 04 Jan 2016 02:12 PM |
making a quick reflection system but I need the rotation of the mirrored part to be the same as the part it's being mirrored from
CFrame.fromEulerAnglesXYZ(math.rad(p.Rotation.X),math.rad(p.Rotation.Y),math.rad(180))
it works but if I rotate it twice on it's y axis, it flips onto it's left side
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
|
| 04 Jan 2016 02:14 PM |
script.Parent.Rotation = game.Workspace.Whatever.Rotation
Scripter, Builder... Yet cant use remote functions worth anything.
|
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 04 Jan 2016 02:17 PM |
It's inside the mirror.
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 02:18 PM |
| Mirror.CFrame = CFrame.new(Mirror.Position, Part.CFrame.lookVector) |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 04 Jan 2016 02:21 PM |
@epic
that points it towards the part
how does that help me at all
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
AkaLua
|
  |
| Joined: 27 Jul 2012 |
| Total Posts: 526 |
|
|
| 04 Jan 2016 02:25 PM |
CFrame:inverse() I dont really know
-____________________________- |
|
|
| Report Abuse |
|
|
Eauz
|
  |
| Joined: 23 Jul 2013 |
| Total Posts: 2942 |
|
|
| 04 Jan 2016 02:27 PM |
I am interested. May you give us a link to the place with the reflections>?
|
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 07:02 AM |
This? Mirror.CFrame = CFrame.new(Mirror.Position, Part.Position + Part.CFrame.lookVector) |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 07:37 AM |
I think you should first get the CFrame relative to the CFrame of the mirror, inverse it, 'transform it to a global CFrame' and apply it.
local part = DEFINE PART local mirror = DEFINE MIRROR local relcf = mirror.CFrame:inverse()*part.CFrame local invrelcf = relcf:inverse() local globalcf = invrelcf/mirror.CFrame:inverse() part.CFrame = globalcf
Whatever, i never made a mirror, so this is just a very, very wild guess lol. |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 05 Jan 2016 10:08 AM |
The mirror is the floor.
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 11:13 AM |
| That should make a difference e.e |
|
|
| Report Abuse |
|
|
| |
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 05 Jan 2016 11:26 AM |
attempt to perform arithmetic on local 'invrelcf' (a userdata value)
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 05 Jan 2016 01:42 PM |
Are you trying to mirror it?
Because you need to work out which axis you're reflecting across, and then just do something like
local x,y,z = part.CFrame:GetEulerAnglesXYZ(); y = -y;
part.CFrame = CFrame.new( part.Position ) * CFrame.Angles( x, y, z ); - |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 05 Jan 2016 01:55 PM |
This is what I think you want...?
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = mirror.CFrame:toObjectSpace(cf):components(); local newCf = mirror.CFrame:toWorldSpace(CFrame.new(-x ,y ,z , r00, -r01, -r02, -r10, r11, r12, -r20, r21, r22));
It makes sense when you look at how a matrix is built for a CFrame.
Normally:
CFrame.new( x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 );
Vector3.new(x, y, z); -- Position Vector3.new(r00, r10, r20); -- Right surface facing direction Vector3.new(r01, r11, r12); -- Top surface facing direction Vector3.new(r02, r12, r22); -- Back surface facing direction
So now that we know how the rotation matrix works it's a simple as adding a negative in some places...
CFrame.new( -x, y, z, r00, -r01, -r02, -r10, r11, r12, -r20, r21, r22 );
From there it's simple! Hope this helped |
|
|
| Report Abuse |
|
|
rvox
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 5380 |
|
|
| 05 Jan 2016 02:13 PM |
| i almost cried from reading this thread |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 05 Jan 2016 02:32 PM |
| Me too, I literally just realised how bad my answer is. |
|
|
| Report Abuse |
|
|