ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 08-03-2007
Regan Blackett Regan Blackett is offline
Flexsim Consultant, Forum Moderator
 
Join Date: Jul 2007
Posts: 14
Downloads: 19
Uploads: 16
Thanks: 0
Thanked 14 Times in 6 Posts
Rep Power: 183
Regan Blackett will become famous soon enoughRegan Blackett will become famous soon enough
Default 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)



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.