Car Physics Help

  1. I’m trying to program a custom car.

  2. I’m having problems with applying turning and gravity to the part’s local orientation.


    In the Motor.run function, the car’s -upVector is added to its speed, so it goes both forward and down when in the air (I have tried this the other way around, doesn’t work much differently). The car works just fine when on the ground, but when in the air, it spins around randomly until it hits something.

In the rotate function (Yes, I need to reorganize the script) I am attempting to convert the car’s CFrame orientation (lookVector) into Vector3 to use in its BodyAngularVelocity. Unfortunately, lookVector returns the orientation as, e.g., (1, 0, 1), the 0 being the number I need to turn. In the current version of the script, you can see the lookVector.X multiplied by the lookVector.Z, which, in this example, would return as ‘1’ (in radians).

  1. Not much previous work to show, my best solution is as shown above. Developer Hub won’t help, as I do not know what to look for.

Place link

And finally, if there is any way in which I could improve this post, please let me know. Although as I am a very lazy person, I won’t be as likely to do so :laughing:

2 Likes

Hello. First, we need to see the whole code. We can’t see the problem without seeing the whole code, as mistakes can be done in that hidden part of code.
Second, you should paste your code here like this:
image
You could also improve your posts by not being too formal.

Example of a formal post
  1. I’m trying to do some stuff.
  2. The stuff doesn’t work.
  3. I have tried doing some other stuff but nothing happened.
Example of a normal, not formal post

Hello. I was working and trying to do some stuff, but I’ve encoutered a problem. For some reason it doesn’t work. I have tried doing some other stuff, but nothing changed. Could anyone please help me?

I didn’t make any mistakes, I’ve already found where the problem is. I’ve shown all code necessary to solve the problem. I am not showing any more, as that would allow people to copy it.

Again, I am simply asking how to do something, there are no problems in the code itself. It works just as it should the way it is currently programmed. I am simply getting help on (two) specific equations, which are listed above.

If you wish for me to clarify something, I can do that too.

Not many people know about DevForums. Those who know don’t use it for malicious purposes. If you browse more of the Scripting Support category, you’ll notice that experienced members that want to solve their problem show their full code. Here is an example if you’re very lazy.

I doubt that you can be 100% sure about that. I had a case where I tried to add parts in a Region3 to a model and run MakeJoints on that model, but the model was always empty. At first I thought that I made some mistake in code that prevents parts from being inserted to the model, but later I discovered that Workspace just didn’t see any parts in Region3.

1 Like

Even if there was another problem…
The problem I am asking for help with here still needs answering, as I have done this before (although not in this way) and know what is needed to be done to get my expected result. The problem is knowing how to do it.

If I need help with another problem in this script, I will make another post. But for now this is all the help I need.

1 Like