0
Answered

Drive with transport surface not working.

Bo Adam 2 years ago in realvirtual.io Starter and Professional updated 1 year ago 21

Hello,

I have a rotating and lifting transport surface. It takes the carrier when it rotates and lifts, but the carrier doesn't move when I jog forward or backward. 

The same carrier works on a different transport unit that is built in the same way, so I know it is not the carrier that is the problem. 
The drive chains move with the rotating platform as desired.

I've added pictues to show the turning lift, I hope you can help me with the moving of the carrier problem!

Image 631

Image 632

Answers

Answer

Hi,

if you use a moving transport surface, please make sure that y is the up vector for both objects holding the drive components. To connect a moving transport surface to a further drive use the components kinematic and group. Example below:

PINNED

I am not sure if this proposal is in general the way to go.

@Preliy: Can you please exlain a little bit more or send us an example project.

Answered

This is due to some Unity limitations - combining physical movements (transport surface) and kinematic movements (axis) is a problem. Please check example scene Assets/game4automation/Scenes/TurningAndLiftingTransportSurface.unity

Basically the TransportSurface should not be a child of the kinematic movements - it needs to be separated but the parent drive needs to be referenced in the TransportSurface

As you can see the transportsurfaces are a child of the main gameobject, not of the Lift/Rotator, so that shouldn't be a problem right?

Under review

ah yes right - did you compared with the demo model - did you see any differences. If you don't find the issue you might need to send us the model and I can check.

Hi Bo, no we are missing all the colliders and meshes if you just send the prefab without dependencies.

Best would be that you zip your whole example project (before please delete the Library folder). After this you could upload here:

https://realvirtual.io/send

When collision happens between Surface and MaterialFlowObject, set MaterialFlowObject.transform.parent = surface.transform. When object leave the collider, set transform.parent back.

For example: 



private void OnCollisionEnter(Collision other)
{
if (!_isDynamic) return;
if (other.gameObject.TryGetComponent(out Entity entity))
{
entity.transform.parent = transform;
}
}

private void OnCollisionExit(Collision other)
{
if (!_isDynamic) return;
if (other.gameObject.TryGetComponent(out Entity entity))
{
if (entity.transform.parent == transform) entity.transform.parent = _pool.Object.transform;
}
}
PINNED

I am not sure if this proposal is in general the way to go.

@Preliy: Can you please exlain a little bit more or send us an example project.

Hello,


I Am now uploading the file, you need p210010_Factory as the scene.

Hi Bo, just downloaded it but I am doing very hard to see where I can check your problems. Could you prepare a very simple separated scene which shows directly your problem when starting it in Play mode? 

I have the new scene, do i just need to upload the scene or the entire project again?

Hello Bo,

sorry, but within your scene the prefab data is missing. (e.g. meshes etc.). Please put your scene and the prefabs incl their data in one folder and export it as an unity package. Thanks.


sorry again, I now have uploaded a package of just the test scene, Created it via the game4automation menu so hope it works.

Answer

Hi,

if you use a moving transport surface, please make sure that y is the up vector for both objects holding the drive components. To connect a moving transport surface to a further drive use the components kinematic and group. Example below:

Hello,

I've found a new bug (when using your version). When letting the transport surface go up and down a few times the transport surface moves more than the rest of the lift.

Hello Bo, we are going to check this issue tomorrow. Maybe there is a rounding problem which is increasing over time. Basically what we do - because of the limitations of the unity physics in compination with "non physics" parent drives is to calculate the deltas of the parent drives and to add it to the transport surface direction. Our guess is, that maybe each cycle there is an very low rounding value which is added in the Up-Direction which might cause your problem. We are all today not in the office and I am going to check it tomorrow for finding a suitable solution.

Hi Bo, I have checked this issue and our guess was correct. There is a rounding problem which I have solved. I will postpone a hot fix until your second problem is also fixed.

Thanks! I am still looking into the other problems, I've found some with the fix of the rotating transport unit (and with the original transport unit script). I am now looking into the problem with the backwards/forwards toggling of this unit, although that feels more like a control issue than a bug because i cant replicate it by hand. I will be testing with the PLC Today.

As I wrote before, just use the following trick. For moving transport surface create new flag. If transport is "Dynamic" then collision events are used.

public class Transport : MonoBehaviour 
{
[Header("Settings")]
private bool _isDynamic;
private void OnCollisionEnter(Collision other)
{
if (!_isDynamic) return;
if (other.gameObject.TryGetComponent(out Part part)) part.transform.parent = transform;
}
private void OnCollisionExit(Collision other)
{
if (!_isDynamic) return;
if (other.gameObject.TryGetComponent(out Part part))
{
if (part.transform.parent == transform) part.transform.parent = null;
}
}
}
public class Part: MonoBehaviour
{

}

2022-10-11 22-04-40.mp4

I have gotten a solution from the Realvirtual team in the past, the problem is that it doesn't work as they told me. So maybe there is something wrong in their scripts, that's why im reporting the bug! 

If they can't find the problem I can try your solution. It is not very clear where I should put your parts of the code since these only look like parts of scripts and there are no example scenes to use, just like your version of the guided transport system.

I really appreciate you responding to my posts, but without examples and complete scripts (like the transportsurface.cs) I'm having a hard time understanding where to put your code (and how to implement it).