#math angles

1 messages · Page 1 of 1 (latest)

obtuse fulcrum
#

platform moving in a circular pattern

paper bay
#

weld it to a smaller invisible part and make said part rotate

#

thats it

#

really

teal tapirBOT
#

studio** You are now Level 4! **studio

obtuse fulcrum
#

@paper bay what

paper bay
#

well you want a platform to move in a circular pattern right?

obtuse fulcrum
#

i still haven't reached the part with attachments, i was thinking about constantly rotating the part and moving it forward

paper bay
#

like thgis?

#

almost like a planet orbit?

obtuse fulcrum
#

i'm aiming for my part to rotate similar to the ones in obbies, but yeah

#

also do you happen to know any reason of my studio saying i'm offline when really i'm not?

paper bay
#

idk but its definitely nothing

obtuse fulcrum
#

aand it kicked me out of my own server, again

#

it keeps on doing that and after some time i can't even team test / join roblox games

#

only for me though

paper bay
#

for the platform you just have to weld the platform to another part and make that part spin

obtuse fulcrum
#

OH

#

well that's what i've been doing but with maths

obtuse fulcrum
#

thought you'd know why

obtuse fulcrum
#

then i spin it

#

buuut that doesn't quite work because the travel distance turns out to be a constant

#

can't give you my current code 'cause studio's not working for me

paper bay
#

do you have a video of the platform?

obtuse fulcrum
#

no, but i can explain what i try to do

#

i tried to base it off of basic formulas

#

getting how much the platform should move, turning that into a value (seconds) and moving the platform that long

paper bay
#

the formula in question being?

obtuse fulcrum
#

i have to rewrite it since studio's buggy and i can't get it back

#

do i also explain the logic or do i tell the logic to myself

#

(the logic behind it)

paper bay
#

just show the formula

#

if you remember it

obtuse fulcrum
#

i don't

#

i have to calculate it again

paper bay
#

oh

#

fuck

obtuse fulcrum
#

i'm pretty good at that

#

i'll explain aswell

#

okay so the part will move the length of a portion (angle / 360) of a circle's length

#

that's the distance

#

the velocity is 14 (studs/s), so speed = distance / 14

#

speed = pi * diameter* angle / (360 * 7)

#

that's it

paper bay
#

im deadass trying to visualize this

#

but

#

uhh

obtuse fulcrum
#

pi * angle / 180 is the angle portion

#

diameter / 14 is the distance portion

#

studio loaded

#
local x, y, z, angle = part.Name:match("([^,]+), ([^,]+), ([^,]+), ([^,]+)")
local wantedPos = Vector3.new(x, y, z)
local originPos = part.Position

local speed = math.pi * (wantedPos - originPos).Magnitude * angle / (360 * 7)
local lastPos = part.Position
local direction = 1
local paused = false
local startTime = tick()

RunService.Stepped:Connect(function(_, deltaTime)
    if paused then return end

    local target = direction == 1 and wantedPos or originPos
    local toTarget = target - part.Position
    local distance = toTarget.Magnitude

    if distance <= 14 * deltaTime then
          part.Position = target
          paused = true
          task.delay(3, function()
              direction = -direction
              wantedPos, originPos = originPos, wantedPos
              speed = math.pi * (wantedPos - originPos).Magnitude * angle / (360 * 7)
              startTime = tick()
              paused = false
          end)
      return
   end

   part.Position += toTarget.Unit * 14 * deltaTime * direction
   local currentPos = part.Position
   part.AssemblyLinearVelocity = (currentPos - lastPos) / deltaTime

   local deltaAngle = math.rad(angle) * deltaTime / speed * direction
   part.CFrame = part.CFrame * CFrame.Angles(0, deltaAngle, 0)

   lastPos = currentPos
end)```

i admit to using chatgpt out of desperation
paper bay
#

bro you are overcomplicating this

obtuse fulcrum
#

i usually do that

#

don't know why or how

#

my main idea is to update the position every frame while rotating the part aswell

paper bay
#

did you use to program in other languages

#

cus that might explain it

obtuse fulcrum
#

i used to program in c++

#

not anymore

paper bay
#

yeah thats probably why

sullen mantle
obtuse fulcrum
#

returning 🙏

paper bay
#

okay but really using welds might be a better idea than this

obtuse fulcrum
#

i haven't learnt those yet

#

but i understand your idea

#

and i think i'm doing exactly that but a little more math

paper bay
#

spoilers: they have nothing to do with scripting but they do with the engine's physics system

obtuse fulcrum
#

i think the formulas are wrong (forgetting about welds)

obtuse fulcrum
#

okay fine

#

how do i implement them

paper bay
#

create a second part

#

then

obtuse fulcrum
#

can i generate (or stimulate) the part using the middlepoint formula i had

paper bay
#

nope

#

just create another entirely

#

without scripts

#

then

obtuse fulcrum
#

for a hundred of them?

teal tapirBOT
#

studio** You are now Level 5! **studio

paper bay
#

create some distance between the platform and the part

obtuse fulcrum
#

can't really do

paper bay
#

can't you just save the whole thing as a model once ur done building it so u can copy and paste it

obtuse fulcrum
#

um

#

i've already placed the platforms

paper bay
#

ah

#

well i guess you just have to rebuild

#

nothing i can do

obtuse fulcrum
#

i'm mainly seeking generalizing

paper bay
#

if you want them all to have the same behaviour

obtuse fulcrum
#

i do

paper bay
#

then ou can just copy and paste

obtuse fulcrum
#

copy and paste what?

paper bay
#

the model of the platform

#

with the script in it

obtuse fulcrum
#

from the scripting guides i've watched i understood that i should never do that

paper bay
#

why shouldn't you

obtuse fulcrum
#

too much memory goes into creating the scripts

sullen mantle
obtuse fulcrum
#

when you can have one main handler script

sullen mantle
#

aight

paper bay
#

well then just weld said platform to the damned part

#

and spin the part

#

thats literally it

obtuse fulcrum
#

generalizationagony

sullen mantle
#

so this is your setup right
the green is your "root"
the red is your platform

your root wants to be anchored
your platform needs to be unanchored
then you use a weld on your root, set the "Part0" property to the root, then the "Part1" property to your platform

obtuse fulcrum
#

i don't have any roots

#

i only have a start point and an end point

sullen mantle
#

same effect that you want though, no?

obtuse fulcrum
#

i'm still believing that there is a way easier way for my brain to handle non-welding solutions to this

sullen mantle
#

then you just add a script like this to the root part

    script.Parent.Orientation += Vector3.new(0, 1, 0)
end```

i did mine server-side which is probably bad for stuff like this
#

trust me, welding would be ideal

obtuse fulcrum
#

i think i can create the root part by a script

#

thank you guys