|
| 29 Mar 2013 06:32 PM |
| I am moving a part by changing its CFrame, and I want to know if the brick touches any other bricks. I can't use the Touched event because it doesn't fire when it is moved with CFrame, so I need to do something else. Any ideas? Thanks in advance for any help. |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:37 PM |
You could math it out. It's actually a pretty complicated problem.
Some simple, partial solutions would be to check whether or not any of the corners or center of the part are in the other part and vice versa. |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:39 PM |
| Hmm... I have a feeling that would cause some serious lag to check every part in the game every time the part moves... Do you know how people do it when they make guns? For example in Call of Robloxia and the bullet physics that can detect if the bullet touches something? |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:39 PM |
Use this method:
Workspace:FindPartsInRegion3()
http://wiki.roblox.com/index.php/FindPartsInRegion3_(Method) |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:41 PM |
@ArbiterOfDeath
The part rotates. Can I rotate a Region3? |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:42 PM |
| You won't be able to rotate, but it is better then nothing. Another option is to rotate an invisible object's CFrame, then position is to the same position before you move the part, and see if there is a collision. Another way would be to scrap the CFrame and use the physics engine found here: http://wiki.roblox.com/index.php/BodyMover |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:42 PM |
Region3's can't be rotated, so if you need the CFrame'd part to rotate, that solution will not work.
If you're worried about too many parts to check, the solution you'd probably want is an Octtree, although that fact you'd need to implement one in Roblox probably indicates we're going about things the wrong way :P, although that will indeed possibly make it much faster if it's done right. |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:46 PM |
| Do bullet physics of games use CFrame or BodyMovement objects? |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:50 PM |
Most use BodyMovement. That's why sometimes you see bullets flying upwards, or down. But if it is a gun, then you may want to know that some make their bullets instant and use ray casting. Note that to use it you must use a UNIT VECTOR, or you will get random results.
FindPartOnRay: http://wiki.roblox.com/index.php/FindPartOnRay_(Method) Raycasting: http://wiki.roblox.com/index.php/Raycasting |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:52 PM |
| I am making a missile that follows a parabola, and I need it to explode on contact. It follows the parabola using CFrame, but I have no idea which BodyMovement object to use. Any suggestions? |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 06:59 PM |
| Rocket Propulsion: http://wiki.roblox.com/index.php/RocketPropulsion |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2013 07:03 PM |
| Okay thanks a bunch, it looks like it will be tricky to learn how to use all of the properties correctly but I will give it a shot. Thanks again! |
|
|
| Report Abuse |
|
|