So, I’m developing a game involving a hover-vehicle (implemented as a MeshPart) that floats just above the ground that needs to maintain a specific orientation using BodyGyro, but the user will also have a bit of control over the orientation to be able to tilt the vehicle slightly.
My problem is that the the origin of a MeshPart simply uses center of the bounding box. And depending on the geometry, the center of the bounding box is not necessarily a desirable rotation point. Here’s an image to help demonstrate my issue.
Now, I do already have a solution in mind for this, but it seems kinda sloppy to me and I was wondering if anyone has a better or more “clean” solution. My idea is to make an invisible part, place it inside the MeshPart where I want my rotation origin, and use a WeldConstraint to weld it to the MeshPart. I would then place the BodyGyro inside the invisible part instead.
Forgive me if I’m missing something extremely obvious, as I’ve not done any development on roblox for several years, so I’m a little rusty. MeshParts weren’t even a thing at that point in time either.
The only issue is that the old body movers are considered legacy objects and we’re supposed to move over to the new ones.
I haven’t used the new movers very much yet, so I don’t know how to replicate the behavior of a BodyGyro, but apparently there are ways to replicate all the legacy body movers. The new ones should use attachments, which means you can probably achieve this offset position without using an invisible block.
Body movers aren’t legacy (at least I don’t think so). You’re probably thinking of constraints, and constraints are not meant to replace body movers. Besides, if you need to do some weird stuff with constraints just to achieve what body moves can do already, then it’s probably sloppier than OP’s current solution.
I thought the same thing, but it’s clear that there are certain things that the legacy objects can do that the new ones cannot. For instance, there’s no solid replacement for BodyGyro. Thus, I think it’s fine to continue using them. They aren’t deprecated, so should be fine to use.
Using a small part as your pivot point is fine too. I’ve done this many, many times for my vehicles.
He’s talking about these, which came out a little over a year ago. I actually had no idea these existed due to not developing on Roblox for quite some time. Multiple people have now said they think my soultion is fine though, so I may stick with it. But the new movers definitely may be useful for other parts of my game, now that I know they exist and have read up on what they can do.