[quote] I’m “fighting” against it because it’d be a terrible addition to the API.
" It has pros, and no cons that you or I can think of"
I can’t remember where from, but in a programming book I read (I think it was in one of the ones an admin linked here once), it gave the following advice (or something around the lines of this)
“Programmers often spend too much time working on code completely unrelated to the objective of the program. Days could be spent on a fancy module that doesn’t even really do anything. When considering new features, the feature should start off with negative points – the lowest grade possible. In order for it to be added, it has to be so useful that it digs itself out of the hole.”
“Because why not?” Doesn’t cut it – that’s a terrible reason for something to be added to the API, or any program. If ROBLOX adds a way to manipulate gravity, then I will welcome a modifiable gravity property with open arms on my knees. Until then, the answer to “Why not?” is that it isn’t useful enough to be added to the API. Not a lot of people work with gravity, so adding something to the API that only a few people use is not only a waste of time but API bloat.
Please do follow up with this when you start your internship. I have no doubt in my mind the staff will concur. I say this not to be harsh, but because I know that no matter what I say you won’t listen to me – you will listen to them though. [/quote]
Now that you actually explained your point of view I understand. You’re correct.
In fact the magnitude option gives more flexibility and I’ve always found the DistanceFromCharacter method useless since magnitude isn’t that much harder.
I guess people are too lazy to go and google how magnitude works even though it is a simple search on the wiki and only requires very basic math.
“With echo’s point then why do we have
Player:DistanceFromCharacter(Vector3)”
That’s a function that provides a certain level of abstraction instead of a constant value. It simplifies:
function distanceFromCharacter(point)
if player.Character and player.Character:FindFirstChild("Head") then
return (player.Character.Head.Position - point).magnitude
else
return 0
end
end
into just local distance = player:DistanceFromCharacter(point), and although it personally wouldn’t have made my addition list, I assume it was added just because they didn’t have anything else to add. If you think back to the very beginning of ROBLOX when they first created the Player object, if you knock out all of the features added “recently” (as in, post 2009) (DataPersistence, Kick, and GetMouse) as well as the default functions inherited from Instance, the only functions the Player object had were:
That’s only four functions. Without DistanceFromCharacter, it’d only be three. My guess is that in attempt to make the Player object more than just an overglorified model, they added DistanceFromCharacter just so it would at least have a decent amount of functions of its own. That, or it’s related to some legacy feature or something that we don’t know anything about.
[quote] “With echo’s point then why do we have
Player:DistanceFromCharacter(Vector3)”
That’s a function that provides a certain level of abstraction instead of a constant value. It simplifies:
function distanceFromCharacter(point)
if player.Character and player.Character:FindFirstChild("Head") then
return (player.Character.Head.Position - point).magnitude
else
return 0
end
end
into just local distance = player:DistanceFromCharacter(point), and although it personally wouldn’t have made my addition list, I assume it was added just because they didn’t have anything else to add. If you think back to the very beginning of ROBLOX when they first created the Player object, if you knock out all of the features added “recently” (as in, post 2009) (DataPersistence, Kick, and GetMouse) as well as the default functions inherited from Instance, the only functions the Player object had were:
That’s only four functions. Without DistanceFromCharacter, it’d only be three. My guess is that in attempt to make the Player object more than just an overglorified model, they added DistanceFromCharacter just so it would at least have a decent amount of functions of its own. That, or it’s related to some legacy feature or something that we don’t know anything about. [/quote]
I think this property should be added, removes a magic number from all your custom physics scripts and that’s always a good thing, makes it more readable and easier to understand/use.
And also, throwing in my share of “useless” functions in the ROBLOX API: