Forum Thread
need math help lua: get object space coordinates (Forums : Coding & Scripting : need math help lua: get object space coordinates) Post Reply
Thread Options
Mar 6 2018 Anchor

this is the problem i have:
i wanna attach a explo on a master object, (vehicle), and need the position from the explo (slave) from view of the master (vehicle).

actually i do a simple vector difference, slave - master, but this works only, if master have a rotation of 0,0,0... by other rotations, the
resulted position fade away.

   local pos = DifferenceVectors(slavepos:GetPos(),master:GetPos());
function DifferenceVectors(a,b)
	return {x=a.x-b.x,

so, i need to get the angles from master in, but how ?
i have pos, dirvector, normalvector, angles from master and slave.
have looked now 2 days trough google and found nothing really helpfull (because i'm not a mathematician and totally not talented in that topic).

please help :)

Edited by: pvcf

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.