I basically want objects to become relative to certain objects movement and rotation when they overlap them.
I read up on it and one example is to:
Code: Select all
--fake BAD code
--set all objects origins to center (x, y)
obj.radius = distance(obj.X, obj.Y, overlapped_platform.X, overlapped_platform.Y) * 1.0
obj.AngleToFaceObject = angleToFacePosition(obj.X, obj.Y, overlapped_platform.X, overlapped_platform.Y) * 1.0 - 180 + overlapped_platform.Angle
--set x and y position
obj.X = overlapped_platform.X + (cosine(obj.AngleToFaceObject - overlapped_platform.Angle) * obj.radius )
obj.y = overlapped_platform.Y + (sine(obj.AngleToFaceObject - overlapped_platform.Angle) * obj.radius )
This problem seems to work only sometimes. I'm trying to figure out what im doing wrong, and then I get confused.
I'm pretty sure the issue is here "obj.AngleToFaceObject = angleToFacePosition(obj.X, obj.Y, overlapped_platform.X, overlapped_platform.Y) * 1.0 - 180 + overlapped_platform.Angle"
I think.