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 |
|
Downloads |
Tips and Tricks Share helpful modeling ideas |
#1
|
|||
|
|||
Controlling the camera view to be focused on a moving object in your model.
Place the following code into the OnDraw trigger of the object (this trigger is found in the objects properties window):
Code:
// Set the view points to the spatial location of the object and rotate the view // the treenode item here is the moving object that you want to focus. // firstly, project location of item into model space double itemposx; double itemposy; double itemposz; itemposx = vectorprojectx(item,0,0,0,model()); itemposy = vectorprojecty(item,0,0,0,model()); itemposz = vectorprojectz(item,0,0,0,model()); // Set view location set(viewpointx(view),itemposx); set(viewpointy(view),itemposy); set(viewpointz(view),itemposz); // rotate the view by increasing rz set(viewpointrz(view),get(viewpointrz(view))+0.2); // return 0 to execute object's default ondraw code return 0; |
The Following 2 Users Say Thank You to Regan Blackett For This Useful Post: | ||
shafizad (03-19-2012) |