Distance In Front of object
Blitz3D Forums/Blitz3D Programming/Distance In Front of object
| ||
Does anyone know the best way to place an object X units in front of another object regardless the way the object is facing. ie if the characters head is facingup at any old angle angle, we would want to put a sphere 3 units infront of its face. I know i can use pivots and parent child relationships, but i need to figure out the math for calculating the location. Any thoughts? |
| ||
entity distance make any sense? and a lil' bit of qn equation like s = j@ |
| ||
TFormPoint x,0,0,head,0 obj_x#=TFormedX() obj_y#=TFormedY() obj_z#=TFormedZ() here's one way, although if you really need it, you can use sin/cos/tan maths to figure it out. |
| ||
Tformpoint ! sweet Thanks bot builder. I didnt understand the use of the function originally when i read it. Im so stoked. Thanks! |
| ||
Alternatively... Each loop: PositionEntity objB,EntityX(objA),EntityY(objA),EntityZ(obja) RotateEntity objB,EntityPitch(objA),EntityYaw(objA),EntityRoll(objA) MoveEntity objB,0,0,5 ; always 5 units in front! Then you can use EntityDistance. But you'd already know the distance in this case. |
| ||
Rob. That would work too. Thanks. I was trying to find a more math/function based solution since it would be faster i think. thanks for the help guys. |