Best way to calculate space between objects
#1

So lets say I want to create a set of objects in one line and leave the same space between them even if some objects are bigger and some are smaller they all will have the same distance between them.

Obviously one thing I would need to know is the size of the object but what do I have to do afterwards?
Reply
#2

I'm not a math guy but if you have the size of the object wouldn't it be a simple point to point distance measurement and then substract the size of each object from that value?
Reply
#3

Hmmm not sure. It's kinda a brain attack. Simple to make a line of objects but harder if there are different sized objects in that line coz the pos gonna change.
Reply
#4

Get the average size, and consider that all the objects are with that size, and calculate the distance you want between these objects
Reply
#5

If its a low amount of objects, you could set up the distance for each object yourself in an array. However, if its a complex set of objects I would recommend you to obtain the collision size with Y_Less include, then add a default minimum distance and you're ready to go. It's not really going to be very exact, but you're going to get good results.
Reply
#6

Someone made an include showing how big certain vehicles were, could be time to have one for objects as well.
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=570965

Then do something similar to the GetXYInFrontOfPlayer function (you may need to do an adjustment depending on the direction).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)