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: Scripting something to be horizontal yet

Previous Thread :: Next Thread 
indyracoon is not online. indyracoon
Joined: 12 Sep 2009
Total Posts: 6666
06 Dec 2015 11:38 PM
How do I script a thing so that it is horizontal to the ground yet parallel to another object?

for example, a block is turned 45o and tilted 45o
the object that would be in need of scripting would be a beam 5 studs below this block, turned 45 degrees but not tilted at all

i initially had this:

beam.Position = block.Position-Vector3.new(0,5,0)
beam.Rotation = Vector3.new(0,block.Rotation.Y,0)

turns out roblox has weird angles so that the x and z axis affect the y axis to be different, causing the beam to turn to angles that are the reverse of what they should be
Report Abuse
BlueKeyblades is not online. BlueKeyblades
Joined: 11 Oct 2014
Total Posts: 220
06 Dec 2015 11:42 PM
CFrame my boy.
CFrame.
http://wiki.roblox.com/index.php?title=CFrame
Report Abuse
indyracoon is not online. indyracoon
Joined: 12 Sep 2009
Total Posts: 6666
06 Dec 2015 11:50 PM
omygoodness i feel like such an idiot rn

i tried CFrame earlier but used improper math (accidentally added a negative) so the brick appeared out of place
spent the last like 4 hours adding like if-then functions to ranges of angles to reposition all of the bricks but
wow


anyways ill get back to you if i figure out it doesn't work thnx
Report Abuse
indyracoon is not online. indyracoon
Joined: 12 Sep 2009
Total Posts: 6666
07 Dec 2015 12:36 AM
nvm, didn't work ._.
Report Abuse
BlueKeyblades is not online. BlueKeyblades
Joined: 11 Oct 2014
Total Posts: 220
07 Dec 2015 01:12 AM
Set a relative CFrame, as in CFrame:toWorldSpace() or CFrame:toObjectSpace() and work from there.

[Work not tested, not bested.]
Report Abuse
indyracoon is not online. indyracoon
Joined: 12 Sep 2009
Total Posts: 6666
07 Dec 2015 01:25 AM
It seems like that has the same functionality as

part.CFrame = block.CFrame*CFrame.new(Vector3.new(0,-5,0))

aka it replicates the angle exactly, i want that except it to be horizontal
setting the rotation doesn't help at all because roblox's x and z rotations majorly affect the y rotation for some reason
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
07 Dec 2015 01:57 AM
Welds or CFrame?

Report Abuse
indyracoon is not online. indyracoon
Joined: 12 Sep 2009
Total Posts: 6666
07 Dec 2015 03:11 AM
>welds
r u srs

>CFrame
just discussed that in the posts above xP
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