How can make a part orbit something, like a player, on different planes, and not just on one (like a solar system), without changing the rotation of the part it’s orbiting?
After messing around, I did something similar, but I did it by changing the rotation of the center part and it doesn’t really move around the player like in the video.
Code
local part = script.Parent
local center = workspace.anchor
local RunService = game:GetService("RunService")
local radius = 5
local radians_per_sec = math.rad(200)
local angle = 0
RunService.Heartbeat:Connect(function(deltaTime)
angle = (angle + deltaTime * radians_per_sec) % (2 * math.pi);
--multiplying it by deltatime to ensure it happens over the course of one second
local x = math.cos(angle) * radius
local y = math.sin(angle) * radius
local z = 0 * radius
local new_pos = Vector3.new(x, y, z)
center.CFrame = center.CFrame * CFrame.Angles(math.rad(45*deltaTime), 0, 0) --[How can I achieve the same effect as the video without doing this]
part.CFrame = center.CFrame * CFrame.new(new_pos)
end)
As you can see, it’s orbiting on different planes because the center is rotating, but I don’t want to manipulate the center part. I want to manipulate only the part that’s orbiting, and I want it to move like in the first video I linked. How would I do this?
This is what I said I didn’t want. The script you gave me is just an orbit on one plane. I’m trying to make it on multiple planes, like in the first video I linked
Think the one you got is way better than that video. It don’t looking like that one is totally just rotating. More of it ends up rotating while darting around line point to line point.
Or maybe something is spinning around and the line is set to head towards where it is at that moment. As the spinning thing is still moving.
I just wanna know if there is a way I can do what I just did, but without manipulating the center part and only just controlling the position or cframe of the part that’s moving. Say if I were to have like magical orbs orbit a player…if I did it the way I attempted, I’d have to put some invisible part in the player and then weld it to like the HRP and idk…it just doesn’t seem like the most efficient way to me.
I don’t want to use the center part at all. I just want to change the part that’s orbiting.
And even then, your method did not work. I stored the cframe of the center part, and added it onto the cframe of the part that’s orbiting after adding onto the stored center cframe using CFrame.Angles, but I still get a regular one plane orbit because it’s actually adding onto the part’s CFrame and not the center.
That thing is moving pretty fast … don’t see how you would do this without some type of center rotating. You’re pretty demanding for someone that can’t do it yourself. This is Script Support, helping you with your script. Not demand a script, I don’t see your scripts at all. Clearly you actually have no clue how to do this yourself. Yet you demand how it should be done. How about you go with the people that wrote you scripts, that understand how this is being done.
This is precisely what I needed! Just one question though if you can answer, which will help me from now on: What exactly is the difference between adding those CFrames.Angles separately as opposed to doing something like
CFrame.Angles(orbitAangle*15, orbitAangle, 0)
There is a difference for sure; something I’m definitely gonna read more about. I was not at all aware of this difference so ty!
Like I said before, I am not looking to match the speed, only the pattern of its movement, which is how it’s orbiting on different planes. And yeah, that’s why I want to know if there’s a way to do this without a center rotating, and how I can do that. And did you not see my script that I posted?? In the expandable tab where it says Code ? I’m not being “demanding.” I’m simply trying to be explicit so that people know the details of my problem. Stop trying to start something plz.
But anyway, the problem is solved by @ComplexMetatable The first script he wrote was not what I was looking for, and don’t worry, I understood what he wrote in the first script, which is why I was able to tell him that it wasn’t what I looking for. However, the second script that he wrote was exactly what I wanted and I learned something new about CFrames from it. I never knew there was a huge difference. Here I thought I was going to have to use some more trigonometry or something ;-;.
What are you talking about … it’s just changing it’s angle as it rotates. While moving at warp speed.
Most of that is while he is moving … and it could be coming out of both ends. Look towards the end of the video. You see two things hanging.
Yes, as it changes its angle as it rotates, it also begins orbiting on a different plane. The two things hanging do not matter, nor does the speed. Only the pattern of the movement.
It’s not changing plains there is no other plain. That pattern is coming for the way it’s updating
Like I said … If you had something on the end of a “rope” rotating around. Then had a point head to where it is ATM while it keeps moving. Then heads for where it is again ATM in intervals you would get the same exact pattern. No matter what you want, this is coming from a rotation.
It’s not the best drawing, but those rectangles u see are the planes I am talking about and if you sort of imagine it in ur head, u can visualize the orb following the outline of one plane to the next plane. Both of us are not wrong.