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: Making a part pivot on it's corner using CFrame?

Previous Thread :: Next Thread 
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:05 AM
?
Report Abuse
Monadic is not online. Monadic
Joined: 03 Aug 2016
Total Posts: 731
18 Sep 2016 02:09 AM
Your lack of questioning and details saddens me.
You should know this, orc.
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:13 AM
Hmm. Well what I'm asking is quite simple if using a Motor6D, I could just edit the C1. However, I'm trying to recreate the effect of a door swinging open.

Stand on one foot, then spin around. That is what I mean.
Report Abuse
Monadic is not online. Monadic
Joined: 03 Aug 2016
Total Posts: 731
18 Sep 2016 02:14 AM
That's much better.
Now wait for someone to help you.
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:15 AM
Alright. I guess you had rights there to question me. I wasn't very clear, I'll own it.
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
18 Sep 2016 02:24 AM
@Monadic

Most of your posts aren't helpful

@OP

You could just add an invisible part on the axis you want the door to rotate, group it with the door and set that invisible part as the PrimaryPart and use SetPrimaryPartCFrame() to rotate it on that axis.

Or use math and object/world space:
http://wiki.roblox.com/index.php?title=CFrame#Local_and_World_Space
Report Abuse
Monadic is not online. Monadic
Joined: 03 Aug 2016
Total Posts: 731
18 Sep 2016 02:25 AM
They ARE helpful.
Look how it helped Orc.
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:26 AM
@Roy

I'd like to not have additional parts; my game is already reaching upwards of 10k parts and MeshParts with intensive collision fidelities. Could you show me an example with the latter?
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
18 Sep 2016 02:32 AM
Actually you don't really need what I mentioned earlier, math should do the trick.

local rotation = math.pi/2--how much you want to rotate
local offset = CFrame.new(1, 0, 0)--where you want axis of rotation relative to center of object

local cf = part.CFrame * offset
cf = cf * CFrame.Angles(0, rotation, 0)

part.CFrame = cf * offset:inverse()
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:36 AM
@Roy

Almost perfect, except like, the corner should never move. It starts moving towards the end ;'(
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
18 Sep 2016 02:43 AM
Could you explain that more or post your code, it shouldn't do that. Make sure you have the offset correct.
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:44 AM
I'm not sure what offset is, only rotation.

local part=script.Parent
local rotation = math.pi/2--how much you want to rotate
local offset = CFrame.new(1, 0, 0)--where you want axis of rotation relative to center of object

local cf = part.CFrame * offset
cf = cf * CFrame.Angles(0, rotation, 0)

local start= part.CFrame

for index = 0,1,0.01 do
part.CFrame = start:lerp(cf * offset:inverse(), index)
wait()
end

I'm just trying to make it turn like a traditional door.
However if that isn't possible without manually making like 300+ calculations I'll just go with this.
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
18 Sep 2016 02:48 AM
Never use decimals as the increment for a loop, it doesn't always work.
Just use this instead.

local part = script.Parent

local rotation = math.pi/2--total rotation you want door to move
local offset = CFrame.new(part.Size.X/2, 0, 0)

local repitions = 100
for i = 1,repitions do
local cf = part.CFrame * offset
cf = cf * CFrame.Angles(0, rotation * (1/repitions), 0)

part.CFrame = cf * offset:inverse()
wait()
end
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:51 AM
thx
Report Abuse
Nameless_King is online. Nameless_King
Joined: 25 Feb 2010
Total Posts: 410
18 Sep 2016 02:55 AM
Hey Orc, I actually made a model in my inventory for a door that you can use.
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 02:57 AM
@Nameless
I already have one, but thanks :P
Report Abuse
Nameless_King is online. Nameless_King
Joined: 25 Feb 2010
Total Posts: 410
18 Sep 2016 02:57 AM
https://www.roblox.com/library/503488895/A-Real-Door
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
18 Sep 2016 03:01 AM
Oh, I see, it has code too. Thanks!
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