Rotation Problem

BlitzMax Forums/MiniB3D Module/Rotation Problem

Streaksy(Posted 2016) [#1]
I've been at this for a while now, and I'm sure I've managed before, but nothing works.

I'm trying to use the rotation of a pivot to project a square infront of it and get the coordinates of the four points. It involves a projection against a horizonatal plane for each point. Obviously, it's for a simple shadow mechanic.

The problem is when the light pivot is aiming straight down. It doesn't handle the rotation properly. I've tried adjusting pitch and yaw in every order but the result is always the same.

Here is an example for one of the corners:

PointEntity LightPivot, PlayerPivot
TurnEntity LightPivot,-5,0,0
TurnEntity LightPivot,0,-5,0
MoveEntity LightPivot,0,0,1000
UpdateWorld

And whereever it hits the plane is the corner of the shadow quad. When projecting straight downwards, the pitch/yaw operations become weird and it projects as a kind of line.

Anyone got experience with this? My brain is melting.


Streaksy(Posted 2016) [#2]
Solved! I attatched a child entity to it, applied the rotation to THAT, and then set the entity's local rotation to the child's global rotation .