Page 1 of 1

Custom pixel version of (sysVectorPolarOffset ...)

Posted: Wed Sep 03, 2014 3:30 pm
by PM
Want a function that works like (sysVectorPolarOffset center angle radius), but uses pixels instead of range for radius? Try this function below! Copy-and-paste it to within the <Globals> of your mod, or wherever your code can access it.

Code: Select all

(setq ex912VectorPolarPixelOffset (lambda (theCenter theAngle thePixels)
	; range 1 = 24 pixels.
	(sysVectorAdd
		theCenter
		(sysVectorDivide
			(sysVectorSubtract
				(sysVectorPolarOffset theCenter theAngle thePixels)
				theCenter
			)
			24
		)
	)
))

Re: Custom pixel version of (sysVectorPolarOffset ...)

Posted: Thu Sep 04, 2014 3:56 pm
by Jeoshua
I've made a utility function for the next version of Parallax Worlds very similar to this. If only the game gave us a normal pixel offset function, or kilometer offset, or any other offset than the 22-some-odd pixel offset that we have now.

You listening George? How about adding a parameter to SysVectorPolarOffset that declares the units to use, defaulting to lightseconds, but able to be any actual unit?