[OPEN-SOURCE] Machinery Modelling Toolkit

That fixed the problem.
I have applied a physical material to them with 0 friction and 0 restitution and things seem to be performing ok. There is still a slight vibration when the vehicle is settling that i think may be caused by the dampers as my spring force is set to the calculated number.

Now i will be looking into implementing the friction components that you used on your car too see if they fix the acceleration while turning issue.

Yes, try to tweak dampeners. They might be too strong and I don’t cap amount of counter-force produced by them.
Start with some small value, like 10, suspension should keep oscillation for a while. Then start raising this value until suspension settles in desired amount of time.

I have had a look into the friction components.
When I disabled my friction code the vibrations stopped. This makes me think that they were being caused by the friction. I lowered my forward force and it made the vibration a very slow forwards rocking motion that I found quite odd.

I have tried implementing the friction component but the code you used seems a bit complex, Could you provide and explanation of what i need to do for it?

I had similar bug with friction. One way to solve it is to filter your input velocity or resulting friction force. Simplest filter is just average over two last frames, which means you need to store velocity from previous calculation. Then you velocity for friction calculation becomes:
(current_update_velocity + last_update_velocity) / 2

The other approach is to calculate friction force as you do already but then don’t apply it directly but calculate average value over few last frames.

I have spent the last few days rebuilding my movements and friction codes to run of the impact points because this is more accurate than what i had before and doesn’t seem to cause the vibrations. One issue I have run into is that the impact point from the “get contact data” node returns the impact point at a either end of the collisions. This means that if i am going around a right corner the point is on the left of the wheel and then when i go onto the straight it is still there and this makes me turn when not turning the vehicle.

Do you know of any solutions for this?

Yes, had the same issue. What I do to solve it is project contact point on the wheels/track plane - like if collision would always happen in the middle of the wheel surface. Basically you first convert contac point location into local space of the wheel, zero-out Y component and convert it back to world space. This will be a contact point in the middle of the surface - as long as pivot point of the wheel is aligned with middle of the surface. Not the most accurate but cheap.
alternatively you can get the same result by vector to plane projection, where plane is world space plane of the XZ axis of the wheel.

Hey,
I was looking into updating my project to the latest UE4 version and my project will no longer compile with your plugin.
Are you working on a new version or do i need to try to fix it myself.

Yes, I’ll upgrade it to 4.18.

Upgraded to 4.18 both Plugin and Content, new version is already on GitHub.

Thanx,

Time to fire it up again… have not updated since 4.12

Доброго времени суток Виктор!
Большое спасибо за ваши труды, мне они нравятся и я использую их в своем проекте.
В частности реализация MMTSuspensionStack, я учусь программировать на С++, путем изменения вашего кода, добавления своих алгоритмов, вроде вполне неплохо получается.
В основном я взял за основу функцию CalculateAndApplySuspensionForce, что бы переделать и оптимизировать под свой проект, получилось то что нужно, хороший “Антиграв”.

Меня интересует этот алгоритм из той-же функции, я все никак не могу понять принцип его работы в деталях, вроде-бы напоминает ПИД-контроллер, только без Интегрирующей и Дифференциальной составляющих, только Пропорциональный и какой-то свой алгоритм затухания.
Проблема в том, что я хотел обобщить этот алгоритм и вынести в библиотеку как независимую функцию выполняющую роль “Стабилизатора”, чтобы ее можно было применить и для “Антиграва” и для стабилизации поворотов, удержания нужного угла.
Обобщить и вынести отдельно получилось, в Антиграве прекрасно работает, но, для стабилизации поворотов путем удержания нужного угла, работает только в одну сторону, я так понимаю что этот алгоритм не хочет воспринимать отрицательные значения на входе, в итоге он либо рассчитывает не правильную силу, либо вообще не работает.

П.С. Не знал как назвать этот эффект удержание объекта в воздухе над землей, но в моей игре эту функцию выполняет “Антиграв”, в случае вашего плагина это Suspension Stack.

Kind time of the day Victor!
Thank you very much for your work, I like your work and I use them in my project.
In particular, the implementation of MMTSuspensionStack, I’m learning to program in C ++, by changing your code, adding your algorithms, it seems to be quite good.
Basically, I took as a basis the function CalculateAndApplySuspensionForce, which would be redesigned and optimized for my project, it turned out that what is needed is a good “Antigrave”.

I’m interested in this algorithm from the same function, I still can not understand the principle of its operation in detail, sort of like a PID controller, only without an Integral and Differential component, only Proportional and some kind of its own damping algorithm.
The problem is that I wanted to generalize this algorithm and put it in the library as an independent function that plays the role of “Stabilizer”, so that it can be used both for “Antigrava” and for stabilizing the turns, keeping the right angle.
Generalize and render separately, it works fine, but in Antigrave works fine, but to stabilize the turns by holding the right angle, it works only in one direction, so I understand that this algorithm does not want to take negative values ​​at the input, in the end it either calculates not the correct strength, or does not work at all.

P.S. I did not know how to call this effect an object holding in the air above the ground, but in my game this function is performed by “Anti-Gravity”, in the case of your plug-in this is Suspension Stack.

This post explains idea behind suspension stack:
https://forums.unrealengine.com/community/community-content-tools-and-tutorials/71452-open-source-machinery-modelling-toolkit?p=926155#post926155

It works as a spring not as controller. The main difference from a Hooke’s law spring, is that here, spring force raises rapidly from 0 to desired suspension force value and then raises more smoothly to a maximum value. This is done to get a better spring response on suspension with short distance travel and sets “zero” of suspension as a desired “default” position instead of a point where suspension is weakest.

Ааа ага вспомнил, я уже видел это, спасибо.
Может быть подскажите, недорогой по производительности и эффективный как пружина, алгоритм для стабилизации поворота?
Что бы силу/ускорение применял и стремился к заданному углу поворота.
ПИД-контроллер в принципе подходит, но не будет ли дорогим по производительности?

Aaa aga remembered, I already saw it, thank you.
Can you tell me, inexpensive in performance and effective as a spring, an algorithm for stabilizing the rotation?
What would force / acceleration apply and aim at a given angle of rotation.
The PID controller is in principle suitable, but will not it be expensive in performance?

PID controllers are really cheap, it’s just few multiplications and divisions. Integral part can become expensive if hundreds or thousands of error values are tracked back in time, but it can be optimized. PID is the simplest controller, don’t worry about it’s performance.

Not sure what kind of algorithm you are looking for. PID works well for roll stability as it’s easy to measure error - just current roll compared compared to absence of it. With turns it’s more tricky as it’s not too obvious how to measure error. Check example with hovercraft that I have, direction I want it to travel is defined by turning red arrow - this is what user controls. But this would be really weird way to control something like a car.
For turning, instead of direction you could control speed of turning and let PID measure the error between how fast vehicle is turning and how fast it should be turning. Just an idea, might not work in specific cases. Overall I would use only where user input is very difficult (steering of hovercraft) or not needed (roll stability).

[QUOTE = “; n1394354”]

ПИД-регуляторы действительно дешевы, это всего лишь несколько умножений и делений. Интегральная часть может стать дорогой, если сотни или тысячи значений ошибок будут отслежены во времени, но ее можно оптимизировать. PID - самый простой контроллер, не беспокойтесь о его производительности.
/ QUOTE]

Спасибо, думаю в моем случае можно обойтись без Интегральной составляющей.
Я буду использовать два контроллера, один для стабилизации по крену, второй для частичной стабилизации по тангажу, в принципе, я представляю какое будет управление.
По крену будет постоянная стабилизация, если кнопки не нажаты то на вход будет подаваться угол полученный от нормали плоскости над которым находится объект, если нажаты то свой фиксированный угол наклона.
По тангажу он будет работать не постоянно, а только в определенном диапазоне поворота, там немного сложнее управление.

Вот самый первый тест, как пример того что я делаю Polygon Glider Test - YouTube

Я боюсь за производительность этого контроллера, потому что я хочу что бы все это работало в мультиплеере с авторитарным сервером, то-есть на сервере будет >50 глайдеров и у каждого такой алгоритм пружины и ПИД-контроллеры стабилизации поворотов, потом еще куча функционала, оружия, магазины, постройка.

Прошу прощения за английский перевод гугл переводчиком, я столько текста на английском просто не осилю=)

Thanks, I think in my case you can do without the Integral component.
I will use two controllers, one for roll stabilization, the second for partial pitch stabilization, in principle, I represent what will be the control.
On the roll there will be a constant stabilization, if the buttons are not pressed then the angle received from the normal of the plane above which the object is located will be fed to the input, if its fixed angle of inclination is pressed.
By pitch, it will not work constantly, but only in a certain range of rotation, there is a little more difficult to control.

Here is the very first test, as an example of what I’m doing Polygon Glider Test - YouTube

I’m afraid for the performance of this controller, because I want it all to work in multiplayer with an authoritative server, that is, there will be> 50 gliders on the server and each has a springs and PID stabilization algorithm, then a whole bunch of functionality, weapons , shops, construction.

I apologize for the English translation of Google translator, I have so much text in English just do not master =)

Like with any optimization, you have to try and see. Profile to find bottlenecks, analyze them and refactor or optimize your code. The algorithm itself is not necessary a problem but specifics of implementation. For example, integral part of PID controller needs an array of errors from previous measurements, so it’s a good idea to pre-alocate this array instead of resizing it dynamically.

Hi.

Ever since i have updated to version 4.18 i have not been able to open any blueprints that reference the mmt pawn base class that was created on the old version or play my game. If I create a new class it will work but copy all the code over from a previous version will be a hassle. The error i get is attached.

Is this fixable?

Did you migrate your project into 4.18? Removed intermediate, binary and save folders?

I have done this and also moved the content to new project and still happens