Global tags/variables

Blitz3D Forums/Blitz3D Programming/Global tags/variables

Spot(Posted 2003) [#1]
I am wondering whether I am defining global right...

In the "EntityPitch#" help it says that you can find the global entity pitch by using "EntityPitch# ( entity[,global] )"

So I have tried
"EntityPitch# ( entity, 1 )"
"EntityPitch# ( entity, true )"
"EntityPitch# ( entity, globaltag )"

I am trying to get the global values for each of these
but when I write them to the debuglog the entity pitch equals 0 when it is rightside up and 0 when its upside down, 90 when its straight up and 90 when its straight down. (shouldn't it be 0,180, 360, 90, 270 and if not how would I get these values?).


Floyd(Posted 2003) [#2]
Here are some notes I once made about the meaning of
Pitch, Yaw and Roll for Blitz3D entities:

Just what do EntityPitch/Yaw/Roll return?

After doing 'RotateEntity e,p,y,r' they return p,y,r.
This is no great surprise. But their individual meaning
is not so obvious. Experimentation shows that doing
the simple turns in the order Yaw,Pitch,Roll gives the same
result as 'RotateEntity e,Pitch,Yaw,Roll'.

RotateEntity e, 0,0,0
TurnEntity   e, 0,y,0
TurnEntity   e, p,0,0
TurnEntity   e, 0,0,r


Now Pitch,Yaw and Roll are reported as p,y,r.

The values are in the following ranges:
-180 <  Yaw   <= 180
-180 <  Roll  <= 180
 -90 <= Pitch <= 90    note that -90 is included.



Spot(Posted 2003) [#3]
Hmm... How would I tell whether the vehicle is upside down or right side up?


BlitzSupport(Posted 2003) [#4]
What does EntityYaw return?


Floyd(Posted 2003) [#5]
Unlike x,y,z the angles pitch,yaw,roll are interdependent.
You can't tell much from just one of them.

When is the vehicle upside down?
I would suggest checking which way its Y+ axis is pointing.

Consider this:
TFormVector 0,1,0, vehicle, 0

This transforms the vector 0,1,0 (the Y+ direction) from vehicle local space to world space.

Now check the resulting TFormedY(). If this is positive then the vehicle Y+ axis
is pointing more or less upward. If the value is negative then it is pointing downward.