|
| 05 Nov 2011 12:27 PM |
Hello !
I'm trying to make a brick that turn around you all time but I don't know how... I think I have to use math.pi... Help me please.
Thanks ! |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 12:28 PM |
What do you mean by turn you around all the time?
~The Official Princess Luna of Roblox~ |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 05 Nov 2011 12:28 PM |
| Rotating (turning) the victim's torso should make him rotate. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 05 Nov 2011 12:31 PM |
Oops, forgot to post
while wait() do workspace.Player.Torso.CFrame=workspace.Player.Torso.CFrame*CFrame.Angles(0,math.rad(5),0) end |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 12:45 PM |
I mean that :
Torso -> Sun Brick -> Earth
The Earth turn around the sun
|
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 12:46 PM |
You mean circle around it?
~The Official Princess Luna of Roblox~ |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 12:47 PM |
Yea
( Sorry if I have a bad grammar, I'm french :p ) |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Nov 2011 02:53 PM |
I respect you because you are French, but I can't help you. Sorry.
~The Official Princess Luna of Roblox~ |
|
|
| Report Abuse |
|
|
Ganondude
|
  |
| Joined: 22 Jun 2007 |
| Total Posts: 1175 |
|
|
| 05 Nov 2011 03:10 PM |
To find the position of an object on a circle, you'll need to know the center of the circle, and the circle's radius (how far the circle is from the center). You can then find the position using sin and cos operations on the angle:
-- local center = Vector3.new(0,10,0) local radius = 10 local angle = math.rad(45) -- 45 degrees in radians
local pos = center + Vector3.new(math.sin(angle),0,math.cos(angle))*radius --
You can find the position at successive points on the circle using a for loop to iterate through the angles, for example:
-- for i = 0,360 do local angle = math.rad(i)
end --
Now we can use the position of a character's torso as the center, and we can calculate where to place a part so that it orbits the player. Note that since the player's torso position is likely to change a lot, we should check the position each time through the loop.
-- local torso = game.Workspace.Player.Torso local radius = 10
for i = 0,360 do local angle = math.rad(i) local center = torso.Position
local pos = center + Vector3.new(math.sin(angle),0,math.cos(angle))*radius end --
From there it's simple to encapsulate everything in another (possibly infinite) loop, and set the position of an orbiting part to the position calculated.
-- local torso = game.Workspace.Player.Torso local orbitingPart = game.Workspace.OrbitingPart
local radius = 10
while (orbitingPart ~= nil) do -- continue the loop while orbitingPart is in the workspace for i = 0,360 do local angle = math.rad(i) local center = torso.Position
local pos = center + Vector3.new(math.sin(angle),0,math.cos(angle))*radius orbitingPart.Position = pos -- set the position of the orbiting part end end --
If you want to have orbiting parts around more than one character, you'll have to find a way to identify which belongs to which player; for this I suggest putting the parts in the players' character's. You may also want to set the CFrame property of the orbiting part, instead of its Position property, so that the part is placed properly even if other parts are in the way. |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 04:19 PM |
Thanks alot =D ! It work
But what is the operation to find a point in a circle ( no lua ) radius * (cos45 + sin45) ?
PS : Don't forget wait() :p |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 05 Nov 2011 04:28 PM |
Bonjour. J'ai regardé ton post et ton grammair anglais est très bien. Tu as un fuftain dans ton post premier. |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 04:57 PM |
| Thanks for your comment and thanks google translate ( or other :p ). What does fuftain mean ? Say it in english. |
|
|
| Report Abuse |
|
|