Distance In Front of object

Blitz3D Forums/Blitz3D Programming/Distance In Front of object

LostCargo(Posted 2003) [#1]
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?


Akat(Posted 2003) [#2]
entity distance make any sense? and a lil' bit of qn equation like s = j@


Bot Builder(Posted 2003) [#3]
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.


LostCargo(Posted 2003) [#4]
Tformpoint ! sweet
Thanks bot builder. I didnt understand the use of the function originally when i read it.

Im so stoked. Thanks!


Rob(Posted 2003) [#5]
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.


LostCargo(Posted 2003) [#6]
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.