News:

SMF - Just Installed!

Main Menu

How can I apply movement

Started by Julius, November 02, 2009, 01:23:35 PM

Previous topic - Next topic

Julius

I trying to make a transport system with the Components Editor, but I don't know how to make the behavior to allow the workparts move on it when a plc output is actived. Somebody knows?.
Sorry for my poor english.

Thanks in advance.

EasyPLC_Master

Hello Julius, if you want that one surface will be able to apply movement to the WorkParts or else movable object, you must to use the code to write the command that allows this behavior.
To do it you must to select the BoxObject that will be the surface where the object will move on, this BoxObject has an Index, then you must to write in the ExternalData method of the body BoxObject object the Vector3 with the direction to apply.
Example:
   box[1].body.ExternalData = new Vector3(1,0,0); //with this line you are applying movement to the right direction to all the movable objects lean on the boxObject

If you type:
  box[1].body.ExternalData = box[1].body.Orientation.Backward * 10; // here you are applying a movement in the Backward direction where is targeting the object, take note that the component can be rotated in the Editor!, and also the speed is increased (* 10)

Hope this helps you!.


Julius


EasyPLC_Master

Warning! for new Machines Simulator v.1.5 is changed:

You must use the Method: void ApplyMovement(Vector3 direction, float Speed)

The first parameter will be the moved object direction and the second the moved object speed.

If you use the method in a box object of a User Defined Component use:

box[0].ApplyMovement(box[0].body.Orientation.Forward, 1);

(Where the box object with id. 0, is the element that will provide the movement)

If you use the method in a object of the installation use:

machine[5].ApplyMovement(new Vector3(1,0,0), 3);

(Where the installation object with id. 5, is the element that will provide the movement)