MeasureRaycast is measuring distances between the pivot point of the Gameobject, the MeasureRaycast script is attached to and a collider or between two colliders.

MeasureRaycast is using the Unity Raycast system for sending rays ino the desired direction and detecting collisions and distances. You need to attach a collider to the 3D meshes you want to detect.

You can also connect the result of the measurement to a PLCInput Signal. By doing this MeasureRaycast is able to act as a sensor.

You can apply the following properties:



The direction of the Raycast in local coordinate system

Measure between colliders

If set to true the measurement is not performed between the pivot point and a collider. Instead rays are set into two directions from the pivot point and the distance between the two detected collisions is measured.

Raycast Length

Defines the maximum length of the raycast in one direction. If you measure between two colliders the total measured maximum distance is twice this given distance.

Display Raycast

Needs to be set to true if you want to see a line in Scene window for the raycast. The line will be red on collision and yellow if no collision is detected.

Raycast to layer

The raycast is always performed only on one layer. As default it is the Default Layer. If you colliders are on a different Layer you need to change this.

Use Millimeters

If set to true as a result one Unity Unit will be transformed to 1000.


A signal offset value which is added to the measurement result.


Displays the distance of the raycast in Scene Window.

Measured Distance

The measured distance as PLCInputFloat. It is 0 if no collision is detected.

Raycast Hit

A PLCInputBool which will be true if the raycast hits an object.

© 2022 in2Sight GmbH - 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