question

Aaron C avatar image
0 Likes"
Aaron C asked Jason Lightfoot commented

How do you get a reference to the 3D Model view?

I want to follow different objects in first-person view at different points in my Process Flow. I found a reference here

https://answers.flexsim.com/questions/45622/ser-view-on-video-recorder-as-first-person-from-op.html

in which @Jacob Gillespie mentioned:

"function_s(view, "follow", object)"
and
"function_s(view, "setFollowFirstPerson", boolean);".

This looks like what I need, but I can't figure out how to get Jacob's "view" reference.

FlexSim 19.1.0
flexscriptviewreferencefollow objectsfirst person
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Jason Lightfoot commented

You need to get a reference to the 3D view you want to tell to start following something. This line of code will get you the first open 3D view:

views().find("active>Documents/Perspective/1+/~")

If you had multiple 3D views open and you wanted to set the follow setting on all of them you could do something like this:

treenode perspViews = views().find("active>Documents/Perspective");
for(int i = 1; perspViews.subnodes.length; i++) {
	treenode view = ownerobject(perspViews.subnodes[i].value);
	function_s(view, "follow", object);
}
· 6
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jacob Gillespie avatar image Jacob Gillespie ♦ commented ·

If you want to set it to follow in a first person view then add this to your code after calling the follow command.

function_s(view, "setFollowFirstPerson", 1);
0 Likes 0 ·
Aaron C avatar image Aaron C commented ·

Works perfectly! Thanks!!

0 Likes 0 ·
Cass Z avatar image Cass Z commented ·
Hi, @Matthew Gillespie ,

May I ask where to put the codes at? Thank you

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Cass Z commented ·
@Cass Z What are you trying to do?
0 Likes 0 ·
Cass Z avatar image Cass Z commented ·
so in my model, the source "on creation" triggers different labels on different boxes, and I want to follow one specific type number. Thank you
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Cass Z commented ·
Then you're going to put the code in the source oncreation trigger I guess or at the point you want to set the follow. If you have multiple objects of the follow type then you might want to set a global variable to the item you're following and then only activate the follow on a new items and set the variable again, when the global variable is NULL.
0 Likes 0 ·