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 » Scripting Helpers
Home Search
 

Re: Finding the positon 90 degrees from a head.

Previous Thread :: Next Thread 
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 07:22 AM
[ Content Deleted ]
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 07:27 AM
[ Content Deleted ]
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
29 Aug 2011 07:46 AM
Two ways I can think of to do it:

1. First, get the rotation of the thing, without the position and stuff.

local Rot = Thing.CFrame - Thing.CFrame.p

That will make the position at 0,0,0 so that all that will be left is the rotation. Next, spin that 90 degrees (dunno what it is in radians).

Rot = Rot * CFrame.Angles(0,math.rad(90),0)

I'm just guessing at the axis, by the way. But I think that's the right one. Now, Rot's lookVector will give you the direction that is to the left/right/whatever of the part, so you can just multiply it to change its length, and then add it to the brick's CFrame.

Pos = Thing.CFrame + (Rot * 10)

2. The simple way that I don't understand how exactly it works:

Pos = Thing.CFrame * CFrame.new(10,0,0)
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 07:47 AM
[ Content Deleted ]
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
29 Aug 2011 07:48 AM
Yeah, I know that radians are based around pi, and like 180 degrees or something = math.pi radians I think, but I learned using degrees at school. Blame America.
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 09:21 AM
[ Content Deleted ]
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 09:32 AM
[ Content Deleted ]
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 09:51 AM
[ Content Deleted ]
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 10:10 AM
[ Content Deleted ]
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 10:21 AM
[ Content Deleted ]
Report Abuse
Spectrumz is not online. Spectrumz
Joined: 22 Mar 2011
Total Posts: 4338
29 Aug 2011 10:25 AM
Wait, what are you trying to do?
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 10:26 AM
[ Content Deleted ]
Report Abuse
Spectrumz is not online. Spectrumz
Joined: 22 Mar 2011
Total Posts: 4338
29 Aug 2011 10:31 AM
"2. The simple way that I don't understand how exactly it works:

Pos = Thing.CFrame * CFrame.new(10,0,0)"

Wouldn't it just be

Pos = Thing.CFrame * CFrame.new(math.rad(10), 0, 0)

?

Or am I misunderstanding....
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 10:31 AM
[ Content Deleted ]
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
29 Aug 2011 10:32 AM
local player
local bot
local distance = 10
pos=player.Character.Head.Torso.Position + ((player.Character.Head.Torso.CFrame.lookVector*CFrame.Angles(0,math.pi/2,0))*10)
bot:MoveTo(pos)
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
29 Aug 2011 10:32 AM
Whatever you're asking, I'm right and you're wrong.

For future reference, see the above sentence.
Report Abuse
comiconor is not online. comiconor
Joined: 26 May 2009
Total Posts: 16893
29 Aug 2011 10:33 AM
[ Content Deleted ]
Report Abuse
ss1122 is not online. ss1122
Joined: 16 Dec 2008
Total Posts: 1601
29 Aug 2011 10:33 AM
[ Content Deleted ]
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
29 Aug 2011 10:34 AM
For my script, switch that '*10' to '*distance'
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
29 Aug 2011 10:35 AM
@comiconor: Because you're doing something wrong.
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
29 Aug 2011 10:36 AM
I don't get why you need rotation, simple positioning would do the job. I'll post a solution in a minute.
Report Abuse
ss1122 is not online. ss1122
Joined: 16 Dec 2008
Total Posts: 1601
29 Aug 2011 10:36 AM
[ Content Deleted ]
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
29 Aug 2011 10:37 AM
Just thought of another possible way to do it:

Pos = CFrame.new(10,0,0):toObjectSpace(Thing.CFrame)

:D
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
29 Aug 2011 10:37 AM
@ss In Portugal you learn both Degrees and Radians.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
29 Aug 2011 10:38 AM
@ss1122: I know that, but degrees are what I understand. I blame president Jimmy Carter for us not being on the metric system >:c
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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