A Flash Developer Resource Site

# Thread: Finding the normal vector of rotated object

1. ## Finding the normal vector of rotated object

Sorry if this subject is discussed already.
I have a Sprite that is dynamically rotated and I want to find its normal vector.

I couldn't resolve this problem only with flash native tools such as Vector3d, but if there exist such solution I prefer it than the pure mathematical one.

2. Normally sprites are 2D so I'm not sure what you would be doing with a 3D vector...

Can you give an example of what you're doing?

3. In flash cs4 and latter Sprites become 3d objects when you give them value for z coordinat or rotationX, Y or Z

4. Interesting question. I think I figured something out.

Let's say the normal vector for a flat sprite is pointing out of the page (ie. <0,0,-1>). You can use your the transformation matrix from your 3d-rotated sprite to transform that normal vector into its coordinates
Code:
`var normalVec = sprite.transform.matrix3D.deltaTransformVector(new Vector3D(0,0,-1));`
which should yield the normal vector for the rotated sprite.

And just a heads up: if you start scaling your sprite, the result of the above code will probably be a vector of length != 1.

5. Yes! Thanks, I don't quite understand how this works but it works (in my case with (0,0,1)).

Strange why here
they are using another more complex way to do this with sprite (child of the sprite that we are talking about), whit offset z = -100.
I think yours is the correct way, thanks

The documentation shows how the basis is defined for the Matrix3D object. While transforming a unit vector pointing down the z-axis into the object's space is probably an okay way of thinking about it, the vector can be pulled directly out of the matrix. This vector will be unit length if no scaling takes place, as mentioned, and the set of vectors which define the basis will be mutually orthogonal if no skewing takes place.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap