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 » Scripting Helpers
Home Search
 

Re: Can you tell where a collision happened?

Previous Thread :: Next Thread 
McBlocker is not online. McBlocker
Joined: 16 Nov 2008
Total Posts: 1721
01 May 2012 05:44 PM
Probably not, but I'm just making sure.
Report Abuse
tofwap is not online. tofwap
Joined: 06 Dec 2007
Total Posts: 6596
01 May 2012 05:45 PM
part.Touched ?

Of course you could also do raycasting and all that fancy stuff.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
01 May 2012 05:53 PM
You could like get teh direction it's travelling at he time of collision and do some fancy math mumbo jumbo to detect approximately where it hit :O
Report Abuse
McBlocker is not online. McBlocker
Joined: 16 Nov 2008
Total Posts: 1721
01 May 2012 05:55 PM
This maybe?

Assuming that radius = part.Size/2 and that the part is a ball...

part.Touched:connect(function(hit)
touchVector = hit.Position + hit.CFrame:pointToObjectSpace(part.Position)
if touchVector.X<0 then
touchVector = touchVector + Vector3.new(radius,0,0)
else
touchVector = touchVector + Vector3.new(-radius,0,0)
end
if touchVector.Y<0 then
touchVector = touchVector + Vector3.new(0,radius,0)
else
touchVector = touchVector + Vector3.new(0,-radius,0)
end
if touchVector.Z<0 then
touchVector = touchVector + Vector3.new(0,0,radius)
else
touchVector = touchVector + Vector3.new(0,0,-radius)
end
print(touchVector)
end)
Report Abuse
McBlocker is not online. McBlocker
Joined: 16 Nov 2008
Total Posts: 1721
06 May 2012 08:25 AM
Yes or no?
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
06 May 2012 08:51 AM
I think you can detect which side it touched.

- Cheers!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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