Implementing Physics Based movement

I wanted to add a different movement system on tank that behaves like a car that can drift when pressed A or D but I don’t know how can I implement this or where I should start. I was interested if there’s a way to use character movement component on the Tank pawn as the movement component has in built setting that allows to make different movement styles. How should I approach doing this

I believe I’ve answered you on Udemy?

This the Event Graph I attempted to add force and torque to the capsule comp but when moving my base Mesh gets detached to from the turret head of the tank and the camera starts spinning and gets detached from its original position where it should be.

I have Simulate Physics checked only on the capsule component and the Mass is set to 1000.

Here’s a video of its behaviour-> https://youtu.be/0ZFB54r9DRs

Ohk an Update for this post I noticed I can constrain the movement of capsule comp to only X,Y plane and after doing that the tank doesn’t split into 2 pieces like before button pressing W the tank moves forward but diagonally right and while pressing S it moves Backwards but diagonally left. Also the tank moves as if it doesn’t have any friction with the floor its moving on and just slides around the whole level.

Here’s another video->https://youtu.be/hqHIB8Boc1E

You would just use the forwards vector when calculating the force to apply. Same with right vector and toque.

For friction look into physics materials.

ohk ill try implementing forward vector and as for physics material I tried putting the rubber physical material on the floor and set the friction override to max and that didn’t change anything as well, maybe that was because I did not have any physics material on the tank it self but I don’t understand how to do I add that on BP_Tank as all the components are deriving from base pawn class and don’t understand the syntax and method required to implement it in code

can you also tell me the node that will allow me to get the forward vector and the right vector

Drag off the CapsuleComponent pin, do you not see it?

You can also view the code prior to the reimplementation here

1 Like

ohk I tried adding forward and right vector but I think I did something wrong because when i press A or D to turn the tank moves left and right very slowly even after having a big ass value and the move forward is just broken as it makes the tank look left and right

Here’s my Event Graph:

You’re feeding that into the location and not the force. Compare

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms