GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 08:39 PM |
How do I Cframe a part? Moving (Loc and Rot) via script?
--Not going to be use for building. I want to try to make a walking animation..--
I'm wanting to learn how to script btw. (Roblox wiki is not helping.) |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Jun 2012 09:00 PM |
part.CFrame = CFrame.new(x, y, z) * CFrame.Angles(a, b, c)
Is the method I use. First 3 numbers are position, next 3 are rotation. |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2012 09:00 PM |
while wait() do p = workspace.Part5 p.CFrame = p.CFrame + CFrame.new(0,.1,0) end |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 09:06 PM |
Okay lemme get this right:
The "part.CFrame = CFrame.new(x, y, z)" is where the "part" will move on the X,Y,Z axis.
And the "CFrame.Angles(a, b, c)" will rotate the "part" on the X,Y,Z axis right?
Also, IF I remember this right.... If I put a 90 in A,B or C it will not rotate degrees right??? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Jun 2012 09:10 PM |
1) Yes 2) Yes 3) Yes, it's in radians; not degrees. math.rad(Degrees) can be used to convert, but I'd recommend remembering the formula that
Rad = Degrees / 180 * pi |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 09:23 PM |
How many Rads are in one degree?
(Rads to me= Radiation....Played to much fallout...) |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Jun 2012 09:37 PM |
Using our formula:
Rad = Degree / 180 * pi Rad = 1 / 180 * pi Rad = pi/180 Rad ≈ .017453293 |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 09:54 PM |
??? Huh? :/
Okay where would I put " math.rad(Degrees) " in " LegR.CFrame = CFrame.new(x, y, z) * CFrame.Angles(a, b, c) "???
Or in other words, how would I use " math.rad(Degrees) "? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Jun 2012 09:54 PM |
Like, instead of a math.rad(a) |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 10:00 PM |
So like this?
LegR.CFrame = CFrame.new(x, y, z) * math.rad(a) |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Jun 2012 10:01 PM |
| CFrame.new(math.rad(a), math.rad(b), math.rad(c)) |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 10:07 PM |
CFrame.new(math.rad(a), math.rad(b), math.rad(c))
A means X B means Y C means Z
Right? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 30 Jun 2012 10:14 PM |
Yes.
(Note it means AROUND that axis) |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 10:16 PM |
| Around= the center of the object? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
| |
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 10:32 PM |
Okay well Ima go making something happen...
Also, if I hit the green button (Play?) will I be able to see the object move?
And one more thing, I have to legs LegR and LegL both are in a group, I would put the script to Cframe those legs into the group that the legs are in right? |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 10:33 PM |
| Oh and this is a Humanoid I'm testing this one (Not the play but a dumb NPC) |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 10:44 PM |
Sorry its Left Leg and Right Leg.
And if I want to Cframe a part it would look like this right?
While true do -- For a loop Left Leg.CFrame = CFrame.new(x, y, z) * CFrame.new(math.rad(45), math.rad(0), math.rad(0)) |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 30 Jun 2012 11:02 PM |
Please go to this thread instead.
http://www.roblox.com/Forum/ShowPost.aspx?PostID=71206634 |
|
|
| Report Abuse |
|
|