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: How do I make it so it is the same rotation?

Previous Thread :: Next Thread 
badfitz67 is not online. 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 is not online. 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 is not online. 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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
04 Jan 2016 02:18 PM
Mirror.CFrame = CFrame.new(Mirror.Position, Part.CFrame.lookVector)
Report Abuse
badfitz67 is not online. 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 is not online. AkaLua
Joined: 27 Jul 2012
Total Posts: 526
04 Jan 2016 02:25 PM
CFrame:inverse() I dont really know


-____________________________-
Report Abuse
Eauz is not online. 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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
05 Jan 2016 07:02 AM
This?
Mirror.CFrame = CFrame.new(Mirror.Position, Part.Position + Part.CFrame.lookVector)
Report Abuse
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
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 is not online. 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
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
05 Jan 2016 11:13 AM
That should make a difference e.e
Report Abuse
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
05 Jan 2016 11:15 AM
shouldn't*
Report Abuse
badfitz67 is not online. 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 is not online. 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 is not online. 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 is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
05 Jan 2016 02:13 PM
i almost cried from reading this thread
Report Abuse
lokkut is not online. 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
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