There's a few interesting pieces on the undocumented features page at shockwavemovies.com (Update: Feb. 21, 2005: These pages are no longer available).
Not really a pitfall—more of a set of tips:
When using modelsUnderRay (), modelUnderLoc (), or modelsUnderLoc (), you may want to only consider certain objects for collision with a ray. We can put a set of models into their own group, and remove the group when we do ray-casting. Assuming that you've already added the models to a group called "ignoreRaysGroup", run the following code for more efficient ray-casting:
SW3DMember.group("ignoreRaysGroup").removeFromWorld ()
M = SW3DMember.modelsUnderRay (vector (1,2,3), vector (1,0,0))
SW3DMember.group("ignoreRaysGroup").addToWorld ()
And replace the modelsUnderRay () call with whichever ray-casting function you need to use.
One method I've used to simplify the process of generating this group is to add an ignoreRays=true; tag to the user-defined properties of models in a scene exported from 3D Studio MAX. Then run the following code to add the ray-invisible objects to their own group:
G = SW3DMember.newGroup ("ignoreRaysGroup")
repeat with i=1 to SW3DMember.model.count
if SW3DMember.model[i].userData[1][#ignoreRays] = "true" then
G.addChild (SW3DMember.model[i])
end if
end repeat
Then remove the group from the world, do ray-casting, then add it back into the world, same as we did before. Obviously there's more work to do if some of these objects aren't accessible from the root of the scene graph hierarchy, but this should get you started.
Move your key-testing code out of on keyDown. The problem with on keyDown and on keyUp is that they're not called until after the key repeat delay has passed.
You can use 3DPI to experiment with particle parameters while your code's running. Through experimentation, you'll find that modifying the following parameters has the side-effect of restarting the system:
Child models are "invisible" to simple searches of this array. To get at each and every model in a scene, we need to perform a recursive search, such as the following: ... (um, never got around to writing this code...)
A lot of useful functionality is hidden by way of omission from the Lingo documentation.
This function is very useful for determining the placement of overlays to indicate, for example, the status of a character in a game. However, it returns void if the point specified lies outside of the camera's frustum. This is a pain, since there are many valid cases for which we need the sprite-space coordinates of a 3D point, even if it isn't visible. To get around this we must perform the world-space to sprite-space transformation ourselves.
We'll use transformation matrices and ...
See Also:
Advanced Havok Xtra Issues