Reverse direction with Vehicle


Im modeling a shifting conveyor atm, and want it to go back and forth. When it moves in positivt x-direction it’s all good and fun. However, when i attempt to move in negative x-direction it does a 180 degree turn. This kind of screws up the functionality of the component. Does anyone have any ideas of how to solve this, or any work-around?

Best regards,


Are you using a Vehicle behavior? If the conveyor bed needs to move then the bed should be in a separate node and that is Translation X-axis, and then use servo with script to move the bed along that joint.

To make a vehicle go in reverse is often done by changing the vehicle’s OffsetMatrix property. For example, get the component’s position matrix, rotate it 180 degrees, and then assign to vehicle. Vehicle is designed to align its X-axis with that of the path direction.

Thanks for the fast reply.

Yes, im using a Vehicle behaviour. Im currently moving the entire conveyor side to side, which is alright considering its fairly representative of how it’s going to work in reality. I’m fairly new to VC but i’ll have a look of how to rotate the position matrix 180 degrees. But how do i change only the x-axis while keeping both z and y in the same position as previously?

Does the attached layout help? Not sure if changing the NOA values of a vcMatrix object would alter the XYZ axes of the vehicle – NOA are generally used to modify the TPC of a robot tool frame.

Test-Vehicle-going-backwards.vcmx (49.4 KB)

Be careful the OffsetMatrix property… it is buggy, which is why I used the event handlers to set its value to None whenever possible. Vehicle origin shouldn’t affect the geometry, so in the layout the wedge should have the same orientation.

I don’t understand why you’d need a vehicle behaviour for a shifting conveyor? Maybe I don’t quite understand what is a shifting conveyor. Would be great to see an example layout where the issue is visible.

In General vcMatrix has N,O,A,P vectors (Normal, Orientation,Approach,Position) which define a 3d position completely. Typically you don’t want to mess around with these vectors but you want to use the methods provided in the vcMatrix like vcMatrix.rotateRelZ(180.0). These methods will make sure that the matrix stays orthogonal.

At first matrices and matrix math sounds scary and seems like matrix is your biggest enemy, but at the end of the day it might be your best friend :wink:

Thanks Zezty, just what i needed. You saved me a lot of headache in the morning! I think my issue was that i was trying to modify the components rotation rather than the offsetMatrix - being fairly new to the software and all that.


eme - I get that it sounds stupid, and it might even be. This is a model based on an existing production system where i’m asked to model the as-is case, so i can’t just ignore it. The point is really that they have very large products produced on two different lines, which are later moved to the end of line where they are picked up to be shipped. So instead of simply having a merger the two last conveyors of the production line can slide to the right/left, disconecting from the production line and connecting to the shipping line. Kinda strange.


Anyhow, thanks for the help!

Okay, I see. Great you got it going!

Just realized i got another problem. When i import the Step files the origin of the component is in 0,0,0 but the Roots are far off from the origin, since they inherent the position they had in the CAD model. Is there any way to redefine where the position of the component is, without moving the roots? I would like to move it to the middle of the Roots, or the middle of the Roots to the component, so my rotations becomes better.

Yes, you can snap or move the origin of a component without moving its geometry. You can do this from Home tab or Modeling tab via the Origin group on the Ribbon. I attached a test CAD file and video tutorial on how to edit the component origin.

Edit-Component-Origin.mp4 (10 MB) (3.7 KB)

I still don’t manage to solve it. Here i’ll attach a small part of the layour. Its the conveyor called “sliding” that is the issue. I want it to travel along the y axis so that the other side of the double-conveyor connects with the other conveyors.

If i try to run the code the first time i import component it kinda works. But as soon as i move it everything gets screwed with my rotation, even if i moved the origin. Is there something fundamentally wrong i do? Is there an easier way to get the same effect?

The moving effect lies withing the “sideShift” part of the code, starting at line 77.

Layout-with-sliding-conveyor.vcmx (145 KB)

I could not open your layout, but perhaps others can help. Good luck.