Alternativa3D 7 mouse intersection without mouse movement tip

Hi! If you’re foced to avoid mouse movement, but still have to find mouse intersection with a some object (e.g. if moves only object), here is a quick tip:

//place this code to the EnterFrame or Timer event handler
var origin:Vector3D = new Vector3D();
var direction:Vector3D = new Vector3D();
var concatenatedMatrix:Matrix3D;
var rayData:RayIntersectionData;

_camera.calculateRay(origin, direction, mouseX, mouseY);

// _containerSurface - object to intersect
concatenatedMatrix = _containerSurface.concatenatedMatrix;
concatenatedMatrix.invert();
origin = concatenatedMatrix.transformVector(origin);
direction = concatenatedMatrix.deltaTransformVector(direction);

rayData = _containerSurface.intersectRay(origin, direction);
if (rayData)
{
  // just highlighting intersected face
  rayData.face.material = new FillMaterial(0xFF0000);
}

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button

Web evolution (its all about Molehill)

Hi! Today I’d like to share with you news about Molehill:

Molehill environment map test
Flash Player 11 Beta released and Unity3D announces support for publishing to the Flash Player.

More information, links to the live demos and tutorials you could find here:
Incubator News Roundup (Molehill)

Some videos here:
Videos of 3D Flash Molehill in Action

“Upcoming 2D rendering engine based on the Molehil API”:
Simple Bunnyhill Demos

Nicolas announced HxSL – shader language for haXe
http://ncannasse.fr/blog/announcing_hxsl

This is a really web-changing event. Unity could bring to the flash quality and fast coded 3d content, and AS3 developers could build a fantastic accelerated 2d and 3d mixed content with help of the new FP. It’s amazing!

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button