Closed B-Interactive closed 7 years ago
Actually comparing the transformationMatrix3D.rawData before and after applying pointAt, it would appear that the transformationMatrix3D is updating. Visually, I'm not seeing it, but perhaps I'm missing something.
I'll keep investigating.
While the transformationMatrix3D's rawData is changing, I'm not seeing any change in the Sprite3D's rotation values before and after applying pointAt.
In the below example, the parent Sprite3D object is spinning on all axis. A child Sprite3D object is what I'm trying to get facing the camera.
private function enterFrameHandler(e:EnterFrameEvent):void
{
rotationX += rotationXSpeed;
rotationY += rotationYSpeed;
rotationZ += rotationZSpeed;
trace("1: " + childSprite3D.rotationX, childSprite3D.rotationY, childSprite3D.rotationZ); // 1: 0 0 0
childSprite3D.transformationMatrix3D.pointAt(stage.getCameraPosition(childSprite3D));
trace("2: " + childSprite3D.rotationX, childSprite3D.rotationY, childSprite3D.rotationZ); // 2: 0 0 0
}
I worked out an alternative solution which is working well:
private function enterFrameHandler(e:EnterFrameEvent):void
{
referenceSprite3D.rotationX += rotationXSpeed;
referenceSprite3D.rotationY += rotationYSpeed;
referenceSprite3D.rotationZ += rotationZSpeed;
var vector3D:Vector3D = transformationMatrix3D.transformVector(referenceSprite3D.transformationMatrix3D.position);
imageSprite3D.x = vector3D.x;
imageSprite3D.y = vector3D.y;
imageSprite3D.z = vector3D.z;
}
Full details here.
Sorry for not replying earlier! I'm currently on a vacation, so I'm not able to respond as quickly as normally.
In any case, I'm happy to hear you found a solution! I added a description of why the transformationMatrix3D
setter is not available in the thread you opened up in the Starling forum.
In a nutshell: I'd love to add that setter, but my math skills are not up to it. :wink: Any help from talented math pros would be appreciated! 😛
Hi Daniel. I'm trying to use Matrix3D's pointAt method to continuously update where many objects are facing (the camera). I've hit a roadblock however, as the transformationMatrix3D property for Sprite3D is read only.
Is it possible to make this a non read only property so Matrix3D methods can be used?