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