I have a vehicle based on AlignOrientation and VectorForces that is just 1 transparent part with another welded to it containing a car body and wheels. When the vehicle goes into a drift, the movement direction remains the same, however the car body is rotated around to make an illusion of an actual drift taking place.
The problem here is that Weld’s C0 does not replicate over to the server. I’m aware that I can use RemoteEvents to replicate it, however I would much prefer getting the movement direction using only 1 single part.
I have tried switching the movement direction from the car’s LookVector to a rotated offset of it (ex. 35 degrees), this somewhat works however I have no clue how to make the car switch directions in the middle of a drift without making it slide from side to side.
How would I go about this?
Any help is appreciated
Why do you need the C0 to replicate to the server? This vehicle is player controlled isn’t it? So that should be handle by the client.
I implemented a drifting mechanic for one of my car games and I found it easiest to just let the car actually drift. When the player pushes the drift control key I simply adjusted the friction of the wheels to allow it to slide. And then increased friction at a rate based on how fast the vehicle was going. It turned out quite realistic.
I understand that part. But you shouldn’t be handling anything dealing with player movement control on the server. It should be all handled by the client.
Maybe I mis-interpreted the issue. You could use a Motor6D and treat the visible car as an animation object. Then run the animation of it turning/sliding from the server. That would replicate to all other players. Otherwise you’d need to attach the car to the player using a Motor6D and use the player characters Animator to animate the car and that would replicate. Last you might be able to keep the Weld but ensure its created by and controlled by the server and that should replicate.
Both, basically I want there to only be 1 part that contains both the forces and the visual elements (body, wheels, etc) but handle the same way as if I were using what I’m using right now (2 welded parts)
If its an illusion then you need two parts, one to carry out the physics forces and one to visualize. If its one model/assembly then you need to make it drift by applying two forces in different directions so it slides.
One force (forward force) goes in the direction the vehicle is facing. The 2nd force pushes it at an angle to force it to slide.
You would have to apply forces at different positions and directions to force the vehicle to rotate. One force pushing forward facing at center mass and the other behind center mass at an angle to add a rotation to it that would “kick out” the rear end.
I rotate the vehicle using AlignOrientation/BodyGyro. Basically my goal is to calculate the CFrame of the 2nd part manually/without using a weld, the rest I can handle myself.
Hmm. Maybe tie the rotation to turning. Harder turn = more rotation up to a limit. Somehow you still need to apply forces to compensate or atleast don’t have the movement force directly locked to the forward facing direction of the vehicle.
atleast don’t have the movement force directly locked to the forward facing direction of the vehicle
That’s what I’m trying to do, I want to calculate the CFrame of the invisible/welded part without it being present so I can set the movement direction to its’ LookVector
So create a phantom CFrame representing the physical part. Maybe copy the cframe of the car before it drifts and apply the force based on that CFrame’s lookvector. You’ll need to switch from worldspace to local space so the direction of the force is applied correctly to the vehicle.