Jump to content

Vector3Extension.Around() question


alexguirre

Recommended Posts

I made my Around() function and I compared it with the LSPDFR Around() function spawning 100 peds with the same radius(10f) and this is the result:YyhTUTj.png

The cops at the left is using the LSPDFR Around() function that @LMS posted and the marines at the right is using my function. So my question is, there is a reason why the LSPDFR team decided that way of doing it?

 

Also here is my code:

 

public static Vector3 AroundPosition(this Vector3 v3, float radius)
{
   return v3 = v3 + new Vector3(MathHelper.GetRandomSingle(-radius, radius), MathHelper.GetRandomSingle(-radius, radius), 0.0f);
}
Edited by alexguirre
Link to comment
Share on other sites

  • Management Team

It's just that you have a random distribution between 0 and radius, while my function guarantees to return a position away radius meters from the origin. This is mostly because we randomize the radius before calling the function (also often preserving a required minimum distance).

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Link to comment
Share on other sites

  • 5 weeks later...
  • Management Team

You simple pass a floating point value as radius that is higher than your minimum. We randomize before the call/have a helper call to do minimum and maximum logic. The function itself has no limits.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...