Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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?

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 User#20388 0 — 6y
0
No I dont mean like using collision to clip through, I want to make clip thru using VELOCITY. User#21146 0 — 6y
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? User#20279 0 — 6y
0
^ Which is what i mean. High velocity, as I said, I'm not talking about CanCollide or Collision Filtering. User#21146 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.
Ad

Answer this question