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
|
||||
|
||||
Moving around objects on high Z-position
If you have objects that are at a certain level (e.g. 10 mtr above ground level) and you are trying to move around the object, the problem is that the moving is relative to a rotation point at the floor. So if you are closeby and you rotate the object, the object is rotate out of view straight away.
So I figured that I can use the viewpointz to change the viewpoint but that doesn't seem to work. Whatever value I enter nothing happens. Is this a bug? I also tried the first person option on the view menu, but that doesn't help much either. I attached a simple model. Try to zoom in on the queues above the conveyor and then try to rotate around it and it shows what I mean. Are there any other suggestions? Maybe as an extra, I just tried to work with 4 views like in AC3d so look at my model from 3 different planes and a normal ortho view, but doesn't work either because the z-plane always stays in the middle of the view. (besides some other weird reaction when moving objects around in a plane but that could be solved with adapting the ortho view) |
#2
|
||||
|
||||
Yeah, I've seen this issue as well. Yes, technically, it's a bug, although it's kind of "by design." I think we just never got around to implementing the viewpoint offset in the z, and it hasn't really come up until now.
|
#3
|
|||
|
|||
If you put this in an OnPreDraw node in the view attributes tree it will keep an object (selected as so() here or whatever you set as objfocus) in the center of the view regardless of its size and elevation:
Code:
treenode objfocus=so(); if (objectexists(objfocus)){ double vrx=maxof(-179,minof(-0.5,get(viewpointrx(c)))); double vrz=get(viewpointrz(c)); double alpha=degreestoradians(vrx); double b=degreestoradians(vrz); double z= zloc(objfocus)+zsize(objfocus)/2.0; double x=xloc(objfocus)+xsize(objfocus)/2.0; double y=yloc(objfocus)-ysize(objfocus)/2.0; double tanval=tan(alpha); if (!get(viewfirstperson(c))&&tanval!=0){ x=x+sin(b)*z/tanval; y=y-cos(b)*z/tanval; z=get(viewpointradius(c)); } setcameradirection(c,x,y,z,vrx,0,vrz); } Last edited by Jason Lightfoot; 11-30-2009 at 04:24 PM. Reason: Updated to account for firstperson view mode |
The Following 4 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (12-01-2009) |
#4
|
||||
|
||||
@Anthony:
Will you put it on the list for version 5.0 ? Or do I have to mail to development for an official request? @Jason: You are KING! Thank you, this is really nice, I have to take a good look at the angles and I think that I can use the highlighted object instead of so() and then it is a very nice improvement |
#5
|
|||
|
|||
Model example
Steven,
In this model you can hold 'T' (for Target?) and left-click an object to set the rotatefocus. Clicking the left mouse button again will clear the focus allowing you to pan as usual. I've also added the library for auto installing this to the DefaultGUIs folder. Last edited by Jason Lightfoot; 12-01-2009 at 07:31 AM. |
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (12-01-2009) |
#7
|
|||
|
|||
Update #1
Added the vectorproject functions. Clicking 'T' on flowitems follows them through the system and allows you to change rotation and zoom.
|
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (12-01-2009) |
#8
|
|||
|
|||
Update #2
Chosen to lock the 'focus distance' in the perpective view when the object is clicked with 'T' pressed. This now prevents the view from zooming into the object at certain angles.
|
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (12-02-2009) |
#9
|
||||
|
||||
Jason,
I don't exactly understand why you create this "DefaultGUIs" node and put the 2 views in there. Is that a special flexsim node that you can use? I was planning to let your gui's simply overwrite the standard GUI's and r so that way when ever you open a new ortho or perspective they automatically have this functionality. Steven |
#10
|
|||
|
|||
DefaultGUIs
The DefaultGUIs node found in /Tools is where the default settings are stored when you right click a perspective or othographic view and choose 'view->set as default'. If the GUIs exist there, Flexsim opens those rather than the standard views defined in the views library.
If you unload the library and then hit 'new model', or open a model without these set as default, then the normal views are restored - which is the main difference in doing it this way I think. Or have I misunderstood and there's an easier way to get them installed? |
The Following 4 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (12-02-2009) |
#11
|
|||
|
|||
Camera viewpoint
Hi,
Instead having a view that is focused on an object with an objectfocus point, I would like to see the view in the other direction, like a camera. I would like to develop an object (camera) coupled to an perspective/ortho view. If the object moves the view has to move instantly. Does any one have already a suggestion how I could do this? I'm know collecting all codes from the forum to see if I can merge and adjust these codes to get it work. But maybe there are already solutions to do this. Kind regards, KvThiel |
#12
|
||||
|
||||
Hi,
please set your view in "more view settings" to "1st person view". You can also change the variables viewpointx, viewpointy, viewpointz, viewpointrx, viewpointry and viewpointrz of persp view in OnDraw-trigger of your moving object. Greetings, Carsten |
The Following 3 Users Say Thank You to Carsten Seehafer For This Useful Post: | ||
Sebastian Hemmann (05-14-2013) |
#13
|
|||
|
|||
Carsten
Good day to you. Is the following statement correct for changing the viewpointx of perspective to the view of the current object? setnodenum(node("/standardviews/perspective>viewpointx",views()),getnodenum(viewpo intx(current))); David
__________________
Advent2 Labs David |
#14
|
||||
|
||||
If current is your moving object it should be something like this:
setnodenum(node("/active/persp>viewpointx", views()), xloc(current)); This code changes the x-coordinate of viewpoint in the active perspective view. Greetings Carsten |
The Following User Says Thank You to Carsten Seehafer For This Useful Post: | ||
David Chan (09-02-2013) |
Tags |
rotate, viewpointz, z-position |
Thread | Thread Starter | Forum | Replies | Last Post |
Moving Conveyor | Brandon Peterson | User Development | 5 | 07-30-2009 06:53 PM |
change the objects in self modeled objects | Manuel Kraenzle | Q&A | 7 | 10-27-2008 02:29 PM |
Output high volume data | Liu Bin | Q&A | 8 | 06-16-2008 09:18 AM |
Operators moving backwards | Nico Zahn | Tips and Tricks | 0 | 05-19-2008 04:51 AM |
Moving Network Node Information into a Table | Brandon Peterson | Q&A | 2 | 02-15-2008 09:46 AM |