User Guide
310 APPENDIX E
{
if (this.loaded)
{
physicalModel = this.createPhysicalModel(10);
removeAnimator(this);
}
}
addAnimator(box);
createConvexPhysicalModel(mass, inertiaScale)
Same as the method createPhysicalModel, though in this version the function, the physical model uses the
convex hull of the SceneGroup, which allows collisions to be much more effi ciently computed by the physics
engine. Settings for mass and inertia should adhere to the same guidelines also described above. Again, note
that setting the mass to ‘0’ will cause the physical model to be fi xed in place, and will also produce more
effi cient(faster) collision computation.
star = SceneGroup(“./star.aer”).add();
star.timestep = function()
{
if (this.loaded)
{
physicalModel = this.createConvexPhysicalModel(5);
removeAnimator(this);
}
}
addAnimator(box);
getPhysicalModel()
Gets the PhysicalModel created by the above methods.
//get the physicalModel already created from a loaded SceneGroup
star.getPhysicalModel();
deletePhysicalModel()
Deletes the PhysicalModel created by the above methods, and all associated physics processing.
//delete the physical model already created from a loaded SceneGroup
star.deletePhysicalModel();
rayIntersectionDistance(Vector rayOrigin, Vector rayDirection)
Given an origin and direction shoots a ray and returns the distance between the origin and the point on the
surface the ray intersects. Note: the vectors must be normalized or the result will be unpredictable.
camera = application.getView(0).getCamera(0);
mouseX = application.getView(0).mouseX;
mouseY = application.getView(0).mouseY
rayOrigin = player.position;
rayDir = camera.getRayDirectionFromPixelCoords(mouseX, mouseY);










