looking at your video there seems to be some interference with your input, it’s visible at around 13.-14. second. the steering bar at the bottom twitches before moving to the left. I suggest unplugging other input devices and try again with the keyboard.
Trying to achieve that on reverse, if press accel = wheels starts spinning forward, without reduction to 0 first.
It seems the problem is at: UFGearWheel::updateWheelSpeed on //ground correction, if (mHasContact).
Because doing some changes i get that fixed, but then, the overall accel/braking not works as previous.
Any idea? Or maybe there is another way to fix that better?
EDIT: What im trying inside (mHasContact is:
if (groundDelta < 0.0f && mVehicle->getEngine()->getThrottle() > 0.0f)
= Spin the wheels
else = as original
All should get fixed without edit “Optimum Slip Weight”, i just want avoid that reduction on reverse, rest the same. Im gonna sleep now, tomorrow i will try with an else if and clone the code, so when reverse + accel will try to change or avoid some code will see.
Changed condition to use getStandardInput()->getThrottleRawInput()
Because with previous one also triggers on braking-reverse.
Using getKMHSpeed() < 0.0f, instead of groundDelta.
After some debug and testing seems this does what i was looking:
bool caseFIX = getKMHSpeed() < -0.1f && mVehicle->getStandardInput()->getThrottleRawInput() > 0.0f;
mRealSpeed += caseFIX ? 1.0f : deltaV;
Still playing around and testing all scenarios but after some hours no weird behaviours found.
@lazybitgames , can you please share some insight on how you pooled the vehicles? I am having consitent crashes. I need to pool my vehicles as spawning a lot of vehicles and destroying them tanks my perf.
I have attached my pooling and depooling functions. Sleep is called when entering the pool. Pooling function is bound to Sleep delegate. This works fine. The problem is exiting the pool. I can calling the depooling function before waking the vehicle and I get this crash
it looks like somehow your physics body is marked to be deleted, idk how that happened though, I tried a similar BP code and didn’t encounter such a problem.
on the other hand my approach to actor activation/deactivation was rather simple, sth. like below code:
void setActorActive(AActor* actor, bool active)
{
//set actor states
actor->SetActorHiddenInGame(!active);
actor->SetActorEnableCollision(active);
actor->SetActorTickEnabled(active);
//set component tick states
TInlineComponentArray<UActorComponent*> components;
actor->GetComponents(components);
for (int i = 0; i < components.Num(); i++)
{
components[i]->SetComponentTickEnabled(active);
}
//...
}