Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Can I Use BodyThrust to Make an Object Travel in a Straight Line Despite Orientation?

Asked by 5 years ago

I'm trying to create a tool where an unanchored projectile moves/rolls in the direction the player is facing by inserting a BodyThrust into the projectile.

Everything is working other than the fact that, once the projectile rolls or tumbles at all, the thrust will continue to act on the brick in the original direction relative to the brick (essentially making it fly all over the place rather than just go in the one direction regardless of the part's orientation). Is there a way to fix this so that the projectile will always thrust towards that initial direction?

0
What is your use case? Nickiel13 58 — 5y
0
What do you mean by "use case"? corncob567 275 — 5y

2 answers

Log in to vote
0
Answered by
AizakkuZ 226 Moderation Voter
5 years ago
Edited 5 years ago

Yes instead try using TweenService

https://developer.roblox.com/api-reference/function/TweenService/Create

0
This is awesome; however, when using it to adjust the CFrame of unachored parts, they go through things. Is there a way to avoid this? corncob567 275 — 5y
Ad
Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

While BodyThrust moves relative to the part, BodyForce does not.

You can use this instance to move the part regardless of the part's orientation.

0
This seems like the answer to my question! Do you know a way to make the force the direction the player is facing? corncob567 275 — 5y
0
@corncob567 You need to take the lookVector of the player's humanoidrootpart's CFrame, so Force=HumanoidRootPart.CFrame.lookVector, then you can times that vector3 to go faster DanzLua 2879 — 5y

Answer this question