I’m currently working on a personal project where I have to do treadmills.
There are many where these follow splines without physics.
In my case, I need to physically simulate the objects so that it looks like a real treadmill.
How do my treadmills work:
OnComponentBeginOverlap(BoxCollision): it detects the object crossing the carpet and sends the information to an actor “X” located in the level.
EventTick: It checks that the object currently in Overlap corresponds to the object saved in actor “X”. If so, it will do an AddActorWorldOffset.
My problem is that after a certain moment, the object traveling on the conveyor belts will not be detected and therefore will no longer move.
Does anyone have an idea/solution to resolve/workaround this problem please?
The best thing to do is to figure out WHEN this happens. You should place print strings that notify you of every successful overlap. So, tag on the print string to whatever overlap event(s) you have. When it doesn’t fire, take a closer look as to why. You may have volumes that are overlapping. Unsure though without more information.
I tried with print strings, but I forgot to look at the logs for the history, sorry.
Now, I know that this “accident” occurs when the object moves backwards during the transition from one conveyor to another and therefore activates the trigger box of the previous conveyor, changing the value of the actor “X”.
The problem is that this makes the verification system obsolete.
If we take the example with a first conveyor “A” and the next which is “B”.
When the object triggers the overlap of conveyor “A”, as a result, actor “X” registers conveyor “A” for the object, the verification system validates the comparison.
Result: The object moves forward.
When the object triggers the overlap of conveyor “B”, as a result, actor “X” registers conveyor “B” for the object, the verification system validates the comparison.
Result 1: In the case of the “accident”: The object moves forward but produces a slight backward impulse which triggers the overlap of conveyor “A” after it has occurred. The verification system does not validate the comparison.
Result 2: The object ends up on conveyor “B” but no longer moves.
The current problem is to resolve this situation where the object can trigger the previous conveyor “A” while it is already overlapping the conveyor “B”.
This verification system was put in place in order not to add the two forward vectors during the transition from one conveyor to another.
Because otherwise, this addition doubles the speed of the objects during the transition.
Either this is simple and you’re making it complicated or it is complicated and I genuinely am having difficulty understanding EXACTLY what you are saying.
PLEASE POST A VIDEO (or link to video) with the print strings so I can see what is going on.
I can’t immediately see what is the issue. However I’ve foind overlaps to be a bit unreliable for this, specially when handling the transition from one overlap to another. So what I can do is share what has worked for me in hopes that a different solution might help with your current.
Create a base class for the conveyors with:
Spline component.
A reference to the next conveyors it would “pass” the actors to.
Float that will represent speed that this conveyor moves the “cargo”.
Make child bp of the conveyor base and modify the spline. I made two to test (straight and left turn) and placed them like so:
Create a manger class with a refrence array of the component in each of the actors that are to be moved in the conveyor. Create a function like this that runs on tick:
You could have the conveyor actors handle the movement, but I’ve found it easier to debug, profile and a bit more performant if everything is in one place.
I didn’t achieve to make the second test because it was way too complex for what it need to be.
And then, i got genius clearance.
So I erased the verification system in the conveyor, add an overlap count on the object and then I divides the Forward Vector by the number of overlap that in the MOVE function of the conveyor.