comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
|
| 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
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
|
| 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
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
Spectrumz
|
  |
| Joined: 22 Mar 2011 |
| Total Posts: 4338 |
|
|
| 29 Aug 2011 10:25 AM |
| Wait, what are you trying to do? |
|
|
| Report Abuse |
|
|
comiconor
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
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
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| Joined: 26 May 2009 |
| Total Posts: 16893 |
|
| |
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 29 Aug 2011 10:34 AM |
| For my script, switch that '*10' to '*distance' |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2011 10:35 AM |
| @comiconor: Because you're doing something wrong. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
|
| 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 |
|
|
|
| 29 Aug 2011 10:37 AM |
| @ss In Portugal you learn both Degrees and Radians. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|