Knocking a projectile back

Hello Community

I have a projectile that is following me (set HomingTarget with projectile movement and so on…).
When the projectile is close to me I want to push it away and it should bounce back to the wall (like Pong, the game).
But I can’t figure it out how to achieve that.
I hope somebody can help me with that.

-Creey =)

By knock back what input or action are you looking to perform to do this fame wise? This 3D fps, tps?

I know how you could do it but how to implement it are dozens of ways.

You can almost look at it like a FPS Tennis Game, but with a homing Ball.
The ball is flying at you and your have to click in the right moment so that the ball doesn’t hit you

You’d likely want to then be checking for the ball distance to the player, perhapse to test you could use a overlap with collision box around the player at the size your looking for

youd want to bind to do a check if the ball is overlapping the box… And then cast to the ball. If it’s homing you’ll need to turn that off and then change its trajectory.

To change its direction one could use set all physics linear velocity.

Are you looking to random deflect it or deflect it in the direction character is looking?

In my game I’m working on mechanics all revolve around hitting a physics ball around. Just need an idea where your trying to get.

The ball should bounce back in the direction the player is looking

Ok assume you have the overlap event working.

On overlap box cast to ball is valid true.

Using the cast set physics linear velocity. This has a vector input.

You would get the player camera forward vector and multiple it by a float. This float would be the speed… The return of this should be a vector which plugs into the set linear velocity.

This should push t in the direction the camera is looking.

If you want it to simply deflect you’d need to also get the linear velocity of the ball and get that length to feed into the multiply instead of a static float value.

Ok thanks, I will try it later :slight_smile:

I can take some screens of a setup to deflect a ball I use later when home.

"Ok assume you have the overlap event
working.

On overlap box cast to ball is valid
true.

Using the cast set physics linear
velocity. This has a vector input.

You would get the player camera
forward vector and multiple it by a
float. This float would be the
speed… The return of this should be
a vector which plugs into the set
linear velocity.

This should push t in the direction
the camera is looking.

If you want it to simply deflect you’d
need to also get the linear velocity
of the ball and get that length to
feed into the multiply instead of a
static float value". - Inph1del

That was the right answer, thanks =)

P.S. I’m quoting him so I can mark the question as answered.