JoeMonnie
|
  |
| Joined: 17 Sep 2011 |
| Total Posts: 407 |
|
|
| 21 Oct 2014 09:54 PM |
I'm going to say this right away, I know almost nothing about scripting, so sorry if I ask dumb questions :(
What I need is a block that spins around in circles. I could use a motor, but I have nothing but problems with those. The block has to be stationary and not move around, but spin around. I don't know if that's easy, but it seems like it would be. Thanks for anyone who helps.
|
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 09:55 PM |
CFrame.Angles() is your friend
guise i have a siggy |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Oct 2014 09:56 PM |
local offset = 10; -- studs (length from origin) local origin = system.Position; local part = blah;
for angle = 1, 360 do part.CFrame = CFrame.new(origin) * CFrame.Angles(0, math.rad(angle), 0) * CFrame.new(0, 0, offset); wait() end |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 09:56 PM |
brick=game.Workspace:findFirstChild("BrickNameHere") while wait() do brick.CFrame=CFrame.Angles(brick.Rotation.X+1,brick.Rotation.Y,brick.Rotation.Z) end
I doubt this will work, but I"m still a novice scripter |
|
|
| Report Abuse |
|
|
JoeMonnie
|
  |
| Joined: 17 Sep 2011 |
| Total Posts: 407 |
|
|
| 21 Oct 2014 10:00 PM |
Thanks for the help everyone, but I want to work with iiUltimate.
Seems like it works, but it's spinning way too fast. Any way to slow it down? |
|
|
| Report Abuse |
|
|
JoeMonnie
|
  |
| Joined: 17 Sep 2011 |
| Total Posts: 407 |
|
|
| 21 Oct 2014 10:02 PM |
| Also, it looks like the block doesn't stay in place. It changes it's postition to 0, 0, 0 |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 10:03 PM |
local spinBrick = coroutine.wrap(function(brick) while wait() do brick.CFrame = brick.CFrame*CFrame.Angles(0,0.5,0); end; end); |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Oct 2014 10:04 PM |
His spins in circles, and he is using incorrect arguments for Angles (and a very bad way to do it, no offense) I assumed you wanted it to orbit. But to spin in place it would be best to do this:
while true do part.CFrame = part.CFrame * CFrame.Angles(0, math.pi/180, 0) wait() end |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 10:05 PM |
put this in the brick
local degrees = 10
while true do script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(degrees), 0) wait() end
not the most efficient but meh
guise i have a siggy |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 10:05 PM |
ninja'd qq
guise i have a siggy |
|
|
| Report Abuse |
|
|
murcury57
|
  |
| Joined: 30 Jun 2010 |
| Total Posts: 90299 |
|
| |
|
|
| 21 Oct 2014 10:05 PM |
Guys guys guys...
No no no no no.
Ew CFrame.Angles()
Use a simpler method, which is also mathematically easier,
local p = script.Parent
while wait() do p.CFrame = p.CFrame * CFrame.fromAxisAngle(Vector3.new(0,1,0), math.rad(1)) end
Change math.rad(1) to a higher number to make it go faster. Also, this will keep it in the same place. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Oct 2014 10:08 PM |
| Out of curiosity, which is faster? |
|
|
| Report Abuse |
|
|
JoeMonnie
|
  |
| Joined: 17 Sep 2011 |
| Total Posts: 407 |
|
|
| 21 Oct 2014 10:08 PM |
@DrMathatica (I think it's spelt...) Works, does just what I want! I can finally stop using motors. I've grown to really hate those...
Wow, so many people wanting to help. Thanks everyone who posted here. |
|
|
| Report Abuse |
|
|
JoeMonnie
|
  |
| Joined: 17 Sep 2011 |
| Total Posts: 407 |
|
|
| 21 Oct 2014 10:09 PM |
@cntkillme
I didn't test yours. Want me to though? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Oct 2014 10:10 PM |
| They both will do the same thing. |
|
|
| Report Abuse |
|
|
JoeMonnie
|
  |
| Joined: 17 Sep 2011 |
| Total Posts: 407 |
|
|
| 21 Oct 2014 10:10 PM |
| oh it's DrMathematica sorry |
|
|
| Report Abuse |
|
|
murcury57
|
  |
| Joined: 30 Jun 2010 |
| Total Posts: 90299 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Oct 2014 10:14 PM |
| mur, stop being so inefficient. Using division multiple times is completely unnecessary. |
|
|
| Report Abuse |
|
|
murcury57
|
  |
| Joined: 30 Jun 2010 |
| Total Posts: 90299 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|