All pastes #737002 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-15 00:42 UTC
rendered paste body
Function Tformpoint:TVector3(vector:TVector3, fromspace:tscenenode = Null, tospace:tscenenode = Null) 
	'This function will convert between cloordinate systems.
	'It will do so linearly- converting first from FROMSPACE to GLOBAL - If necesary!
	'and then from Global to Tospace. This will give us all three steps
	'necesary to do the required conversions WOOP.
	Local returnvec:TVector3
	Local matrix:TMatrix4 = New TMatrix4
	
	If fromspace <> Null Then 'TBC- Convert from FROMSPACE to GLOBAL.
		fromspace.getWorldTransforms(matrix) 
	EndIf
	
	'TBC: 
	'This code translates from global space to local space (from global to TOSPACE)
	If tospace <> Null Then
		tospace.getWorldTransforms(matrix) 
		ReturnVec = matrix.mulWithVector3(vector) 
	EndIf
	
	Return returnvec
End Function