Source

By using a Source script, new movable units (MUs) can be generated. MUs can be generated in intervals or automatically generated once the last generated MU has travelled a certain distance away from the source. This is useful to automatically generate MUs on a conveyor. The object with the Source script attached to, is like a template. Each time a MU is created, the Source creates a new instance of the object under the defined root Destination in the scene hierarchy.

This tutorial shows how to create a custom source:

The source can also manually create (MUs) when you press “C”. The source will deletw all generated (MUs) when you press “D” on the keyboard.

This is the property window of the source:

Properties

This Object as MU

Defines which part should be generated. Should normally point on the same Gameobject where the source component itself is attached to. This is also the standard setting.

Destination

When the source is generating a new MU it can be placed as a sub Gameobject under the defined Destination Gameobject.

Enabled

Must be set to true for the source to work.

Freeze Source Position

Should be usually set to true - the source will not change its position.

Don’t Visualize

Hides the source so that only the created MUs are visible.

Mass

Sets the Mass of the created MUs.

Set Center of Mass

Sets the Center of Mass of the created MUs.

Center of Mass

The Center of Mass.

Generate on Layer

Unity Layer where the MU should be placed to after creation.

On Create Destroy Components

Maybe some scripts on the MU, which is a copy of the source, should be destroyed when the MU is created. You can define here the components to be destroyed.

Create in Interval

Creates MUs in a constant interval in seconds. If the value is 0 this option is not used.

Automatic Generate On Distance

Automatically creates new MUs when the distance of the last created MU is greater than the defined value. Optionally the distance can be also randomly (equally distributed) between the defined Distance (“Generate if Distance”) plus / minus the “Range Distance”.

Number of MUs

Limits the number of generated MUs.

SourceIOs

Gernarate MU - should be turned on for making the source work.

Source Signals

PLCOutputBool Signal (e.g. from a PLC) for generating MUs.

Events

Unity Event which can be used for custom scripts which are called when an MU is created.

Public Interfaces

If script is attached to the Gameobject of the MU, which implements the Interface “ISourceCreated” a Method “OnSourceCreated” is called on the MU when it has been created by the MU.

Public properties and methods

Please check the Realvirtual.io Class Reference for more information about the properties and methods of this component.

© 2022 in2Sight GmbH https://realvirtual.io - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.

Last updated