Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a brick clip through a wall using only velocity?

I've been trying to make a brick clip through a wall using velocity, So the wall is 2 studs thick and the brick is 4 studs thick and brick is a stud away from the wall, (and 60 FPS)

Here's my code

thickness = 2
own_thickness = 4
space = 1
fps = 60

velocity = (thickness+own_thickness+space)/(1/fps)

script.Parent.Velocity = Vector3.new(velocity,0,0)

I did this and the velocity was 420, but the brick bounces off the wall instead of going thru it, can someone help?

4 comments

0

If you want a part going trough another I suggest using collision groups if not, I have no idea what you want then xD http://wiki.roblox.com/index.php?title=Collision_Filtering

0

No I dont mean like using collision to clip through, I want to make clip thru using VELOCITY.

0

^ I don’t think there’s any way to do that unless that velocity is REALLY high, which then probably makes the part go around or go through the wall at a really fast speed. Why can’t you just use what Red said? Or just maybe make the part non-collidable?

0

^ Which is what i mean. High velocity, as I said, I'm not talking about CanCollide or Collision Filtering.

1 answer

Sorry for wasting your time, I found the answer myself :D

own_thickness = 1 -- How thick the part is in the direction (x,y,z) it's gonna go. (in studs)
wall_thickness = 4 -- The wall's thickness in the direction (x,y,z) that the part will go through. (in studs)
space_between_wall = 4 -- Distance between the wall and the part. (in studs)
space_for_to_go_thru = (own_thickness*2)+(wall_thickness*2)+(space_between_wall*2)
 
formula = (space_for_to_go_thru/(1/60))*2
print(formula)
script.Parent.Velocity = Vector3.new(formula,0,0) -- depending on which direction it's gonna go.

This discussion is preserved as it was. New answers, comments, and votes are closed.