ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
Rotating BasicTE
Attached is a sample model with some custom code in a BasicTE.
The code is mostly default code in the Begin/Update/Finish Offset triggers. The difference is a few lines in the Begin Offset code that determines the shortest angle to rotate to pickup the flowitem: Code:
double mz = fmod(zrot(current),360); double theta = radianstodegrees(atan2(y,x)); double rz = theta - mz; while(rz > 180) rz -= 360; while(rz < -180) rz += 360; To use the other end, the calculation just needs to add 180 degrees to mz in the code: Code:
if(getitemtype(item) == 2) mz += 180; Last edited by Phil BoBo; 08-15-2012 at 03:47 PM. |
The Following 7 Users Say Thank You to Phil BoBo For This Useful Post: | ||
syseo (08-15-2012) |
Thread | Thread Starter | Forum | Replies | Last Post |
why the BasicTE can not move? | LINWEIXU | Q&A | 0 | 08-14-2009 09:24 PM |