generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Any Reliable way to get the Speed a Part was hit at?

Previous Thread :: Next Thread 
bombsaway8 is not online. bombsaway8
Joined: 07 Apr 2013
Total Posts: 173
23 Sep 2017 06:16 PM
I need to be able to do something like this:

Part.Touched:Connect(function(Touch)
print(Touch:GetFullName().." hit "..Part:GetFullName().." at the speed "..HitSpeed)
end)

HitSpeed would be how fast it got hit at.

Thanks.



R$100 R$100 R$100 R$100
Report Abuse
badguy1233 is online. badguy1233
Joined: 23 Jul 2009
Total Posts: 885
23 Sep 2017 06:22 PM
--Touch.Velocity?

--Or maybe you could so this

--Touch.CanCollide=false

pos1=Touch.Position
wait(.1)
pos2=Touch.Position

local speed=(pos1-pos2).magnitude/100*60*60
print('Touch is moving at '..speed..'mph')

idk hope that helps :\
Report Abuse
cabbler is not online. cabbler
Joined: 19 Jun 2015
Total Posts: 735
23 Sep 2017 06:41 PM
Part.Touched:Connect(function(Touch)
print(Touch:GetFullName().." hit "..Part:GetFullName().." at the speed ".. tostring(Touch.Velocity.Magnitude))
end)
Report Abuse
badguy1233 is online. badguy1233
Joined: 23 Jul 2009
Total Posts: 885
23 Sep 2017 11:04 PM
Touch.Velocity.Magnitude

Didn't even know that existed lmao

^he knows whats up
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
23 Sep 2017 11:45 PM
.Magnitude of vectors is the distance of the vector from (0,0,0)

velocity is just a vector3 value so velocity.magnitude is the distance of the velocity's force from 0,0,0 which is basically its velocity as a single number


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
23 Sep 2017 11:49 PM
Is no velocity lost before the .Touched event is fired, cabbler?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
23 Sep 2017 11:50 PM
er, *momentum?
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
24 Sep 2017 12:18 AM
I'd assume that Touched will fire after the collision is solved.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
24 Sep 2017 12:25 AM
So the part passed to the function will have the post-collision velocity?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image