Not being a 'programmer' per se, I am struggling with Scripts and Scriptor. Can't seem to get my head around it as there are no real good explanations in the Help file. Does anyone have or know of any decent examples wtih Scripting in it?
Here are some steps to create a script where the animation of a door opening plays when you are within a certain distance from the door:
First create the animation:
1. Open Animator from the Tools Panel of the Home tab.
2. Click the Add scene button to add a scene
3. In the scene view, select the door. When selecting the door, hold down shift to cycle through the selection resolution so that you only select the door and not the frame as well. Alternatively, select from the selection tree.
4. With the door selected, in the Animator tool, right click on the scene you created and select Add animation set > From Current Selection.
5. Click the rotate animation set button in Animator. You should now see the rotate gizmo in the scene view.
6. In the scene view, select the X axis of the gizmo and drag the gizmo so that the origin is placed on the left side edge of the door. This will allow the door to swing open rather than spin around.
7. Back in Animator, click the capture keyframe button.
8. Drag the time slider or enter the time of 3 seconds to move the time slider to that point in time.
9. Drag the blue curve of the gizmo to rotate the door about the Z axis.
10. Click the capture keyframe button. You’ll now have a keyframe at 3 seconds of the door open.
11. Unselect the rotate animation set so the gizmo is no longer displayed.
12. Click the play button. You should now have an animation of the door opening.
Now that you have the animation, create the script:
1. Open Scripter from the Tools Panel of the Home tab.
2. In the Scripter tool, click the add new script button.
3. In the events panel, click the on hotspot button.
4. In the properties of the On Hotspot event, set the radius to about 10 meters
5. For the Position click the Pick button, and the cursor will turn into a cross-hairs
6. Pick a point on the door in the scene view.
7. Back in Animator, in the actions panel, click the play animation button.
8. In the properties, set Animation to the animation set you previously created.
9. Very importantly, mark “Enabled Scripts” in the scripts panel of the Animation tab. Without this turned on, your scripts will not run.
You can now use the walk navigation tool to navigate closer to the door, and once you are within 10 meters, it should swing open. If you want to play the animation again, just toggle scripts off/on.
Attached is the sample file I created from the steps above. There is an animation you can play of the camera moving toward the door. Make sure you have “Enabled Scripts” turned on when you play it.
Product Support Specialist
Autodesk Product Support
I'll take a look at this and get back with you. I'm sure there'll be more questions. This is uncharted territory for me.
After spending much time and trial with many errors, I found some neat thing with this feature.
I'm afraid I can see no simple way currently to allow your bunny to appear when you approach it. This would require either the Load Model script to allow append actions as well as replacement open actions, or alternatively, an action that allows you to hide or unhide the bunny on demand (and you append the bunny to the existing file in preparation).
You could conceivably animate or transform the bunny off into the distance at start of playback and snap it back at the point you desired (if I recall correctly, animations don't have to be smooth transitions but default to that). A little kludgy and it might cause odd model bounding box effects depending on where you moved it to, but it might be a suitable workaround depending on your scenario (e.g. animate/transform the bunny off inside a cupboard or something).
I'm not sure the act of deleting the viewpoint animation and still referring to it in Scripter is supposed to work quite like that. You may be relying on undefined behaviour there. Generally I'd recommend not deleting components of the file on which you are reliant
Hope that helps,
PS: On the original question of how does one use Scripter, my concise take on it would be that Scripter is intended to be a way to link up events that trigger actions; each script representing one pairing of a set of events with a set of corresponding actions. It is a first take on providing interaction within your Navisworks model.
Each script is composed of one or more events that, when triggered via any desired logic (e.g. pressing a key OR moving into a hotspot), causes the associated actions to run. There is a variables system built in that enables more complex logic to built up out of multiple scripts e.g. you could have a script that OnKeyPress of J increments a variable, and another script that runs when that variable reaches three and plays an animation. With OnStart, OnAnimation, OnScript & OnTimer events, you can chain scripts & script effects together more directly.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.