I am having an issue in my game where characters falling from a great height, will hit the Terrain, and go through it. Some characters in my game are scaled down.
So, I was thinking of adding a .Touched event to the HRP, and if the Terrain is touched, and the characters Y velocity has been in the negative for over 1 second, then I will stop the characters falling, and make sure they are placed above the Terrain at their current X,Z coordinates.
However, even when I anchor them, or cframe them, the velocity remains.
So, what are the best and most effective ways to stop the velocity of the parts in a character model.?
Thanks.
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you canât answer the three questions above, you should probably pick a different category.
Why not just have a minimum Height a playerâs character HRP can be at, and whever a playerâs character HRP position changes you check if its below that height and if it is respawn them onto the map.
Thats more avoiding the issue rather than solving it, but I do appreciate the input.
However, knowing how to effectively stop velocity will not only help me in other areas but might help someone else.
For insance, when I had a pet that followed the player (flying), if the player was too far away, the pet would âspawnâ (cframe) to the player, but the velocity of the pet would make it shoot past the player after spawn. So even in that case knowing how to stop the velocity would help.
local function removeVelocity(character)
local vectorZero = Vector3.new(0, 0, 0)
character.PrimaryPart.Velocity = vectorZero
character.PrimaryPart.RotVelocity = vectorZero
end
local zeroVelocity = Vector3.new(0,0,0)
local function removeVelocity(character)
local primaryPart = character.PrimaryPart
primaryPart.AssemblyLinearVelocity = zeroVelocity
primaryPart.AssemblyAngularVelocity = zeroVelocity
end
i always do Vector3.new() but your suggestion might be faster to type (lol i just realised you bumped it, is bumping a thread forgivable if you give advice like how you did?)
And of all my threads, I have created, this was one, where the solutions given just didnât seem to work for me, and so I moved on to other things, yet it always bothered me that I couldnât get velocity of a part to stop, and THIS is the one that gets bumped, and so I keep getting notifications for all these replies. XD So, please lets just let it die.