of     1   

SimpleSet
#225680467Wednesday, September 27, 2017 11:17 PM GMT

I am trying to move a player from a blast in the direction relative to where the blast was and how close by them it was. The problem is with direction. How do I aim the direction the players will be launched from where the blat occurred? #help
AIexandxr
#225682125Wednesday, September 27, 2017 11:57 PM GMT

body position
Nikkulai
#225684483Thursday, September 28, 2017 12:53 AM GMT

Try using lookVector
SimpleSet
#225685012Thursday, September 28, 2017 1:07 AM GMT

How would I use body position in this? :L
Skylake_X
#225685060Thursday, September 28, 2017 1:08 AM GMT

is it an explosion or a custom scripted explosion R$22,792
Nikkulai
#225685281Thursday, September 28, 2017 1:14 AM GMT

Do something like this: blast.Touched:connect(function(hit) nikk = Instance.new("BodyVelocity", blast) nikk.maxForce = Vector3.new(math.huge, math.huge, math.huge) nikk.velocity = blast.CFrame.lookVector*100 wait(.5) nikk:Remove() end)
SimpleSet
#225691034Thursday, September 28, 2017 3:50 AM GMT

You obviously do not understand. I mean when there is an explosion, I want players to be flown away from it with realistic direction.
Quasiduck
#225693833Thursday, September 28, 2017 6:43 AM GMT

Your direction would be, (player.Position - explosion.Position).Unit*SpeedValue Ideally, players closer to the explosion will get pushed back further. So you could use as input for some velocity class: (player.Position - explosion.Position).Unit*MaxSpeedValue/math.ceil((player.Position - explosion.Position).magnitude)
Nikkulai
#225696492Thursday, September 28, 2017 11:47 AM GMT

Wow i try to help out and dont even get a thanks. What a bummer. But the thing is i never really understood what you meant by "a blast in the direction relative to where the blast was" So im sorry if i got confused because you said blast and not explosion.
Soybeen
#225697257Thursday, September 28, 2017 12:35 PM GMT

mutiplier = 10 -- how strong the force will be function Boom() character.PrimaryPart.Velocity = (explosionPosition-char.PrimaryPart.Position).unit*multiplier end
Soybeen
#225697560Thursday, September 28, 2017 12:53 PM GMT

@Quasi It's the unit of explosionPos-playerPos not playerPos-explosionPos That would send them flying towards the explosion (implosion?) XD
Quasiduck
#225706053Thursday, September 28, 2017 7:32 PM GMT

No, that's wrong. @Soybeen. Think of it geometrically, you start at explosionPos and travel along the vector -explosionPos to arrive at the origin. Then you travel along the vector playerPos to now arrive at the player's position. So you've gone from the explosion, to the global origin to the player position. This is the same as if you just went straight from the explosion pos to the player pos. Which is the direction we want.
SimpleSet
#225712863Thursday, September 28, 2017 10:51 PM GMT

I figured it out... mostly. I just got the difference in x, y, and z and used that. #help
gohan31865
#225713231Thursday, September 28, 2017 11:01 PM GMT

isnt there a property in explosions that determines the force of the explosion? that force pushes stuff away, including players if they don't die why won't u use that? #code error("you're*")
SimpleSet
#225714975Thursday, September 28, 2017 11:50 PM GMT

Because I am making a custom explosion. #help
SimpleSet
#225719067Friday, September 29, 2017 1:46 AM GMT

Okay the problem now is increasing the force the blast exerts on you depending on close you are to it without changing the direction where it is implied. It has been bugging me as it only increases as you go further out rather than closer. #help
SimpleSet
#225720136Friday, September 29, 2017 2:19 AM GMT

And no, (player.Position - explosion.Position).Unit*MaxSpeedValue/math.ceil((player.Position - explosion.Position).magnitude) doesn't work. You clearly do not understand the dilemma, which is partially my fault for not fully explaining. the problem is converting this into just the right amount of force to push someone back at a realistic angle while still increasing the closer they get. That is my problem. #help
Rerumu
#225720163Friday, September 29, 2017 2:19 AM GMT

CFrame.new(explosionLocation, torso.Position).lookVector that's your direction thanks
Rerumu
#225720243Friday, September 29, 2017 2:22 AM GMT

Velocity = CFrame.new(explosionLocation, torso.Position).lookVector * distanceFromExplosion * playerMass; if you want everything to be accounted for
SimpleSet
#225721838Friday, September 29, 2017 3:15 AM GMT

Thank you so much, I now understand how you get the distance Diamond. One small problem remains is how can I make the force a bit stronger to the outer parts without drastically raising the force when you get closer? #help
Rerumu
#225722348Friday, September 29, 2017 3:33 AM GMT

Make it an exponential function.
Quasiduck
#225749451Friday, September 29, 2017 11:54 PM GMT

My solution does work. However, it doesn't rely on force as you wanted. It relies on updating the velocity. This is mainly because I see an explosion as an instantaneous force which isn't maintained enough for acceleration to occur. Therefore, setting only the velocity to a correct degree would suffice (where other forces like friction/air resistance would slow it down). It also DOES take into account pushing back closer players further.

    of     1