Adding a Rotating Static Mesh and Controlling the Rotation
From FleshWorks
by ProjectX
Contents |
Prerequisites
This tutorial assumes basic knowledge of T3ED and a room already setup for which to test the rotawheel. nowledge of the Adding Havok Physics to Arbitrary Objects tutorial will help, but is not required.
The Method
To Begin
Add a mesh that you want to steadily rotate to your level, and add two buttons, one either side of it.
- To the rotating mesh (for want of a better word we'll call it a wheel) add the properties actor-> bNotMoveablePhysics and actor-> bNotMoveableRender. Set these both to false. Next add the properties Movement-> Physics. Set this property to PHYS_Havok. Finally set the property Physics-> StartActive to true.
- Go and add the property Scripts-> TriggerScripts. Click the add button on the property and a shiny new place for putting in your script appears. Click the ... button to open the script editor.
The Wheel's Scripts
Wow. A script. Hardcore programming. Let's do it. Click "new" and name it someting like "rotawheelstart". Add a condition. The condition will be
When propagated message [start] detected on linked object [MYSELF]. This tells the script to run when we tell it to. More on this message thingy later. Now add the actions
Set Physics KeyFramed state on actor(s) at end of [MYSELF] to [TRUE] and
Set Angular Velocity X:[0], Y:[45], Z[0] degrees/second. This means that the mesh will rotate once every 8 seconds, around the Y axis and that it recognizes that it sould do so. Finally add the action
Reset script conditions and actions.
NOTE: If you want the wheel to rotate costantly change the condition to
When map sim starts, either from travel, load or launcher. You are now done. If you are making it with two buttons, continue with the tutorial.
Now for a second script. I know, you're still recovering from the last one, go have a coffee and a lie down. I'll still be here by the time you're done. Create it the usual way, but this time call it "rotawheelend". This time our condition is
When propagated message [stop] detected on linked object [MYSELF]. Now add the action
Set Angular Velocity X:[0], Y:[0], Z[0] degrees/second - this puts an end to its merry rotations. Finally add the action
Reset script conditions and actions and you're done.
The Buttons' Scripts
Before adding some more scripts, you must first set up two Triggercript Links, one from each of the buttons to the wheel. Add the properties highlight-> highlightdist and add frob-> isfrobbable. Set Isfrobbable to true and add a highlightdist of about 48, but size may vary. This allows us to "use" our button.
The Start Button
To the start button we are going to add another script. This time, it will be called "rotawheelmessagestart" or something equally clear and concise. The Condition should be
When I am frobbed by player and the action will be
propagate message [start] to linked object(s) [TriggerScript]. Then finally add
Reset script conditions and actions.
The Stop Button
To the stop button we are going to add a similar script. This time, it will be called "rotawheelmessagestop". The Condition should be the same:
When I am frobbed by player and the action will be
Propagate message [stop] to linked object(s) [TriggerScript]. Then finally add the all-important
Reset script conditions and actions.
Final Notes
There may be some garish mistakes or typos in this and if you spot any then please fix them for me. If this doesn't work for you then make sure you've followed the tut carefully, if it still doesn't work then play around to see if I'm missing something logical in the tutorial. If I am, please rectify my mistakes for me, as that would do a great service to everybody else. Finally if all else fails start a thread on the TTLG T3 Editors Guild forum and I'll probably see it.
Back to Physicalizing Objects Tutorials Page
Back to Mission Design: World Objects Tutorials Page
