How to use the code to set the position of the light source, I want to change the position of the light source over time.
Thanks a lot.
How to use the code to set the position of the light source, I want to change the position of the light source over time.
Thanks a lot.
You can set the location and rotation the same way as any other object in the model.
Here is one solution for you:
Object tempLight = Model.find("DirectionalLight1"); Vec3 tempVec; tempVec.x = tempLight.location.x+1; tempVec.y = tempLight.location.y+1; tempVec.z = tempLight.location.z; tempLight.location = tvec;
Here is another that does not use the Vec3 variable type:
Object tempLight = Model.find("DirectionalLight1"); tempLight.location.x += 1; tempLight.location.y += 1;
I hope one of these works for you, Brandon
Brandon's solution works if you have Light objects in your model in FlexSim 2020 or later.
If you are using an earlier version of FlexSim or you aren't using Light objects, then you can modify the values of the view's light sources.
For example:
Object current = ownerobject(c); treenode view = param(1); treenode light = first(viewlights(view)); double x = fmod(time(), 10.0) - 5.0; double y = -1.10; double z = 1.5; set(rank(light, 1), x); set(rank(light, 2), y); set(rank(light, 3), z);
13 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved