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: CFrame help

Previous Thread :: Next Thread 
zarman3402 is not online. zarman3402
Joined: 18 May 2013
Total Posts: 1449
20 Apr 2016 05:54 PM
The following code demonstrates rotating a part so that its position stays the same, but the lookVector (defined as the vector coming out of the front face, or Vector3.new(0, 0, -1) transformed to the parts rotation matrix), is now pointed at 0, 75, 75.



Workspace.Part.CFrame = CFrame.new(Workspace.Part.Position, Vector3.new(0, 75, 75))


My question is: Why are there only 2 things within the parenthesis of CFrame.new()? Isn't it supposed to have 3-- x,y,z?
Report Abuse
zarman3402 is not online. zarman3402
Joined: 18 May 2013
Total Posts: 1449
20 Apr 2016 05:58 PM
Also, whats the difference between CFrame.fromEulerAnglesXYZ and CFrame.Angles?
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
20 Apr 2016 05:59 PM
because the first argument is the origin of the CFrame. and argument 2 is the Vector3 that the CFrame will be looking at.


Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
20 Apr 2016 06:00 PM
answering your second question, they are the same.


Report Abuse
zarman3402 is not online. zarman3402
Joined: 18 May 2013
Total Posts: 1449
20 Apr 2016 06:03 PM
I have more questions.
CFrame:inverse() If the regular CFrame is (1,1,1) will this make it (-1,-1,-1)?
CFrame:lerp(CFrame goal, number alpha) And I don't understand the explanation the wiki gives for this (returns a CFrame interpolated between this CFrame and the goal by the fraction alpha)
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
20 Apr 2016 06:36 PM
idk about those. they seem like advanced CFrame functions.


Report Abuse
DivinePheonix is not online. DivinePheonix
Joined: 30 Mar 2011
Total Posts: 11190
20 Apr 2016 07:36 PM
Test that out in game and see for yourself!
local CF1 = game.Workspace.Part.CFrame game.Workspace.Part.CFrame = CF1:inverse()

CFrame:lerp() The description is a bit weird but its super valuable!
(returns a CFrame interpolated between this CFrame and the goal by the fraction alpha)

local CF1 = game.Workspace.Part.CFrame
local Goal = CFrame.new(0,5,5)
for Index = 1, 10 do
game.Workspace.Part.CFrame = CF1:lerp(Goal,Index/10)
wait(.2)
end

It positions a CFrame between two points (CF1 and CF2) by the Alpha.

If you wanted it to move half way your Alpha would be .5, full distance would be 1
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