That’s sure possible. New track friction component doesn’t require a suspension anymore and can use collision information. Which means that tracks as on heavy construction machinery (with little to no suspension) can be simulated.
The arm can be done with physics constraints, but it will take quite some time to tweak every joint and mass of part to make it look stable. Better results could be achieved with PhysX Articulations: Articulations — NVIDIA PhysX SDK 3.4.0 Documentation
but its not exposed in UE4. Potentially, it can be added with c++ code.
I’ve seen your other post where you already tried using physics constraints. Using target orientation or position of the constraint is the way to go when it comes to controls. The jittering and parts getting disconnected is something normal for PhysX. You could minimize it by setting more position and velocity iterations on parts in properties, enabling projection on physics constraints and tweaking mass of the parts - there shouldn’t be more that 1 to 10 mass difference between constrained parts. Most likely you will still have problems when trying to lean on arm against the ground. More stable solution would be to use Articulations as I’ve mentioned in previous post.
There is something else you can try too. I’ve exposed function to BP which allows to set Inertia tensor of the simulated body. It can help with stability if you set a much smaller inertia on axis that should be mobile and very high inertia on axis that should be locked. There is an example of using this function on propeller, in Simple Examples map.
Thank you for both of your responses!
“Unfortunately”, the development of the backhoe simulator that you saw on my post in other topic (and the cause of me coming here asking these questions for you) is almost at the end. It would not be very good to go messing around with this right now, but there are another simulators coming in the near future and i’m sure these informations that you told me will be useful.
I’m not skillful on the UE4 yet, i’ve been developing in it for 6 months only (and not constantly), but I will surely be looking in what you said. Thank you again.
Update: Performance optimization
Moved track animation component into c++ and refactored some of the BP code. Speed up is about 3 times according to profiler. Now we roll down the hill about 24 LightTankCpp vs 8 LightTank for the same amount of GameThread cost. There is no rendering optimization as there are no LODs for geometry or animation of tracks, so this can be improved too.
Unfortunately we can’t really spawn all 24 tanks on the same machine with the decent FPS. They take about 50ms to process and large portion comes from syncing physx bodies to render meshes. Which is understandable as each LightTank has a lot of components in it. Tanks with simpler suspension, like M113 or Tiger, should have much better performance.
But regardless, I have couple more ideas on how to get better performance and tidy up code. For example, it makes a lot of sense to merge Sprocket/Idler/Roadwheel collision components with friction. The other components that need to be ported to c++ are drive train parts, they have plenty of simple math that need to be run on sub-steps or ticks, so this will impact BP’s performance too much.
The other part that makes sense to spend effort on is removing communication between components from BPs. I’ll see how it can be done. Simplest is to build everything as a single component similar to VehicleComponent in UE4, but this will severely effect flexibility of what we can build and I would prefer to have this system more like lego, where you can combine different parts and it will just work.
Is this of any help for the project?
Thank you for the links! I’ll check paper, maybe will get some ideas we could use.
nice job on this plugin, that’s some really impressive work! Do you still have an example for a skinned track? Would you have to use a spline? or does it work by looking at the track mesh itself.
I can check if I still have really old version of the “Tracked Vehicle” project where M113 used skinned mesh. Overall, it’s not too difficult to set it up, you just need Animation BP to move bones in relation to the wheels and do a small alteration to the math which calculates movement of the treads along the spline to pan material of the track. The reason I’ve stopped using it as it was taking more time for me make mesh, rig it, export it and wire animation BP. In production you would need to do it ones. You could even reuse animation BPs between multiple tanks as long as bones have the same name.
Skinned mesh should be actually faster in terms of performance, I was planning to use it as a LOD level for current setup.
makes sense, thnx for the answer! I’ll see what I can come up with.
I’ve found that build, had to cut it out of the project as there were some marketplace assets, I hope it helps:
I’m not sure if math is correct in regards to how fast material should be moving, but this is a general example of the setup.
Main class is Car_Motor_Custom_Physics, inside of it AnimateTreads is a function responsible for animating material of the skeletal mesh.
Animation of the skeletal mesh geometry is done in Animation BP, it simply checks where wheels are located in the EventGraph and uses their coordinates to move bones.
Let me know if something is not clear, it’s not the cleanest and best documented example
Good day, please help to solve the problem.
As with traction to get the acceleration, the speed?
for example
Unfortunately I do not know English and could not properly explain this to have to use the Google translator.
No matter what kind of engine, its main characteristic is the weight and pulling force.
It just set the maximum speed in cm / s is easy, but I need to set the force in Newtons, but AddForce does not understand this, but as a convert, I do not know.
I hope understand.
You need to multiple your Newton parameter by a 100 as UE4 uses centimeters as unit, not a meter.
As to traction force, I had impression that it’s different for different type of vehicles - expression for traction force on tanks would be different than on cars. It should be proportional to the mass of the vehicle that is being pushed. Do you have some formula for this?
No, I do not know the formula.
Before, I watched an interesting effect, if you put the linear damping 1, it turned out that the glider is accelerated to nearly the same speed, which I have in the variable thrust.
I thought I may have what some formula that is able to calculate the acceleration on the basis of traction.
Here is my glider
He keeps in the air thanks to the PID controller, the friction of the ground is not available, there is only air resistance, the weight of 1 ton.
The effect of Linear Damping is proportional to the mass of the object, so if you have two objects of 100 and 1000kg then linear damping of 50, for example, will slow down lighter object 10 times faster as object is 10 times lighter. Just be aware of that.
I’ve read about traction force and I’m not sure it would be useful to you, assuming we are talking about the same meaning of traction force, it’s a bit weird that you use it in a context of the jet engine. Normally it’s used on something like train locomotives or trucks to compare them to each other or to know upfront if a specific train can pull some specific load of wagons/carts. For jet/rocket engines, the terms that I know are Specific Impulse, Thrust and their variations. You could describe “traction force” for an aircraft if you replace rolling friction with the air drag, but there should be a different term for this in aerodynamics already.
I do not know which unit it uses force.
As for traction in Newton that was my assumption.
This is a database of Russian games Mechanoids
For example, the most simple engine
The most powerful engine http://dl2.joxi.net/drive/2016/10/03/0014/3365/982309/09/0e4aa8e2f4.png
It is already calculated in the game http://dl2.joxi.net/drive/2016/10/03/0014/3365/982309/09/95d95cb74d.png
The total weight of the glider and the engine turns 1080 kg
The game is a sci-fi so it is difficult to determine something.
Got it, even if those values are not completely realistic, they might be, we just don’t know exact equations. This is what you can do.
-
Maximum acceleration can be derived from F = m * a as
a = F / m; where F is force of your engine from the database (just don’t forget to multiply it by 100, so you are working in Newton * cm in UE4 instead of Newton * m) -
Your maximum speed can be derived from the air drag using assumption that you reach maximum speed when propulsion force of the engine is equal to the force of air drag. We can use wikipedia’s definition of the terminal velocity for this:
Terminal velocity - Wikipedia
Just replace m*g with the Force of your engine. Other parameters should be similar if you use physic’s formulas for air drag.
If you use linear damping as approximation to air drag - I would advise not to, as air drag has both linear and quadratic dependency on velocity and Linear Damping is just linear. It can be fine for gameplay but you still need to know how it is calculated in UE4 to derive maximum velocity (personally, I have no idea how linear damping is calculated in UE4). Quadratic air drag to have a nice subtle behavior when used for anything from airplanes to cars, hovercraft, aerosled, tanks and etc. There is example of air drag component in MMT_Contet which uses the same “classical” formula of air drag as described in wikipedia. You can find example of it’s usage on Aerosled, there should be two components, one for main body and one for engine’s radiator.
- Maximum speed with engine afterburner (форсаж) can be calculated in exactly the same way, you just need to add “afterburner force” to base force of your engine.
PS: I’m fluent in Russian, so if you have doubts in regards to translation just add Russian version too. So we can understand each other easier but at the same time not to exclude other people
Ох, вы мой бог, я пол года с этим мучаюсь:)
Но от русской версии я бы не отказался, а то второй абзац переводчик выдает какой-то не совсем понятный набор слов.
Да, я пробовал использовать AirDrag 3D и он конечно же работал, но насколько я понял эта сила сопротивления о воздух не была пропорциональна массе глайдера, ибо если я увеличивал массу глайдера, максимальная скорость не естественно увеличивалась.
Вот когда выставлял 0.9-1 линейное затухание и подавал в AddForce (ForwardVector*1500), то глайдер разгонялся до примерно того же что и подавал.
Я уже запутался и плохо понимаю как должно быть правильно.
По идее так и должно быть. Логика которой я следовал такая: с одной стороны у нас есть двигатель который толкает корабль вперед с другой стороны у нас есть сопротивление воздуха. В стабильном полете по прямой, силы будут направлены в разные стороны и максимальная скорость будет достигнута когда силы равны по магнитуде.
Чем выше масса атмосферного корабля, тем выше должна быть сила двигателя чтобы достичь тойже скорости, за тоже время - ускороние дожно быть пропорционально выше новой массе.
Так как сопротивление воздуха это тоже сила, финальное “негативное” ускорение от сопротивления воздуха тоже зависит от массы, так как a = F / m.
Таким образом мы получаем систему где если у нас есть два одинаковых корабля и один из них загружен грузом а грузовой отсек второго пустой. То более тяжелый корабль достигнет своей максимальной скорости медленее чем более легкий корабль но его максимальная скорость может быть выше.
Ради интереса можно вывести граф, в целом ускорение от двигатля и от сопротивления воздуха должно меняться линейно в зависимости от массы. Но сила сопротивления квадратически завязана на скорость на “высоких” скоростях.
The question was: When using air drag component, why maximum speed goes up as mass of the vehicle goes up?
Short answer: Air drag is external force and change in velocity (acceleration) due to external force, is calculated in Newtonian mechanics as a = F / m. The higher then mass the large force is needed to reach the same acceleration.
Implication of this is following: If we have two atmospheric ships which are exactly the same but one of them is carrying cargo and one has an empty cargo hold. Then heavier ship would take more time to reach it’s maximum speed as it’s acceleration would be slower, but his maximum speed can be larger as larger air drag force is needed to slow it down.
Пропустил по поводу второго абзаца:
корабль достигает максимальной скорости когда сила сопротивления равна силе тяги двигателя. Так как сила двигателя уже задана константой, нужно определиться с силой сопротивления - использовать формулу из физики или апроксимировать линейны выражением.
Огромное спасибо, пойду просплюсь, а завтра все сделаю.
Thank you so much:)