Closed Skeletonxf closed 7 years ago
Edit: I'd prefer to have a 'BodyTransform' class which would be for bodies, I'll see how to implement it.
Does this suit your needs? https://github.com/matiasah/shadows/wiki/BodyTransform
You can attach lights & stuff to that transform by using the transform of the stuff you want to attach.
Just use whatLight:GetTransform():SetParent( LightWorld:TrackBody( whatBody ) )
This page https://github.com/matiasah/shadows/wiki/Light has become out of date with the additions :P Yes this works very well for what I need, however I had to add a line to BodyTransform.lua at line 6
BodyTransform.__index = BodyTransform
as the metatable method wasn't getting looked at by lua and initially I was getting
Error: shadows/BodyTransform.lua:22: attempt to call method 'SetLocalRotation' (a nil value)
Whoops, looks like I missed it. Just added it, so we're fine?
Should be now.
Would it be possible to attach lights to bodies, specifically the love2d physics bodies this library can sync up with so that the light gets automatically destroyed when the body does and the light just follows the body around till then?