how to calculate the angle of fall of a vector on a wall - unreal-engine4

Screenshot
Player shoot Line Trace by channel.
Code

Related

AI Vision - Object Arc Trajectory identification and getting Angle

i saw this example and i would like to measure an arc trajectory first and after that get the live object trajectory position accordingly.
The iPhone camera and the object are always mounted/located on the same position/distance. Only the object can only rotate in its Z axis.
Is is possible to get live position/angle values using its known trajectory in AI Vision?
The sample rate would be 1/second, like taking a picture sending to AI Vision engine and get an angle back?

Unity bouncing ball with scripts

how do I create a bouncing ball in unity that bounces to the same height and that I can make it fall quicker or slower? I've tried to do it from rigid body settings but the ball keeps climbing and I can't control the falling speed. Help
Multiply your desired height vector with a positive sine wave (negative values get multiplied by -1) and add this to your initial position of the ball.
To control the speed of the ball you can multiply the value you use to evaluate the sine function with another factor.
heightVector * |sin(time * speed)|

Zero-crossing detection in simulink

I would like to know when to enable/disable zero-crossing detection option in Simulink blocks. Please explain with an example. What happens if we disable the option and run the simulation ?
I know that zero-crossing detector will tell number of times signal is crossed zero or changed sign. But I want to know when we've to enable this and a real-time example with its use ?
Example of bouncing ball referred here can be seen in the link provided below by phil Goddard in his comment.
I understand the dynamics of bouncing ball. Initially a ball is thrown upward with initial velocity 15 m/s. So if we see the velocity plot, Initially velocity is decreasing and when ball reaches its top, velocity is zero and then ball starts to fall down and velocity is increasing in the -ve direction. when ball touches the ground, kinetic engery is converted into potential energy and little heat energy and again potential energy is converted to kinetic and ball starts to raise. That's why At position zero, velocity is again rise up to maximum and the same sequence follow. I ran the model with both zero-crossing detection enabled and disabled but I didn't see any difference in the scope plot.
Thanks in advance.
You can use a combination of sign block from simulink>math operations library and saturation block by adjusting the limits of saturation block to 1 and 0. Then do product with -1 followed by addition of 1 so that the output shows 1 when signal is below 0 and output is 0 when signal is above 0.
Block diagram of zero crossing detector:
&
Output of zero crossing detector:

Unity - Matching Speed While Transistioning From Traveling on a Single Axis to Rotation Around a Circle

I am working on a simple project that consists of a ball with a rigid body being pushed along the x axis. The ball needs to transition 90 degrees and continue straight up.
I've created a box to serve as a pivot/rotation point and placed it exactly 5 units above the beginning of the 90 degree transition from and exactly 5 units away from the end of the transition. I've created two colliders that work as triggers; one at the beginning and one at the very end of the 90 degree transition.
So my ball will come zooming along on the x axis and hit the first trigger. When it does I reset the ball's velocity to zero and parent the ball to the box serving as a pivot/rotation point. I've then applied angular velocity to the box so that the ball will rotate exactly 5 units around the pivot point. When the ball hits the second collider at the end of the transition it is un-parented and velocity is reapplied so the ball can continue straight up.
So here is the question; if the ball is 5 units away from the pivot point, the distance traveled for the 90 degree transition would be something like : 5 * 2 = the circles diameter * PI = 31.4 units distance around the circle / 4 = 7.84 game units to travel for the entire 90 degree transition.
So how do I match the velocity the ball had while traveling solely on the x axis so that it has the same speed while transitioning using the pivot point rigid body's moveRotation function around a circular axis?
If I have a velocity vector of (-10, 0, 0) when I hit the first trigger how do I calculate what to feed into the moveRotation function so that a the ball, rotating 5 units away from the pivot point, is still traveling at 10 units a second?
Taking the original velocity (-10, 0, 0) and multiplying by the distance needed to travel for the 90 degree transition(7.85 units) looks really close but I can figure out how to check it.

iPhone Pong Advanced Deflection Angle

I am currently developing a simple Pong game for the iPhone. Currently using CGRectIntersectsRect for the collision detection and as for the deflection of the ball when it hits the paddle, I just multiply the ball velocity with -1 (therefore reversing the direction of the ball).
What I am trying to do is to make it so that when the ball hits the paddle, it checks whether how far is the ball from the center of the paddle, and increases the deflection angle the further the ball is away from the center of the paddle. (E.g. In this case, the ball will be deflected back at 90 degrees no matter where it came from, as long as it hits the center of the paddle)
How am I suppose to do that?
Any help would be greatly appreciated.
Thank you.
What you have given us are reference points (centre and edge). What we need are a reference line from which to measure the new angle. Additionally, what you are saying is not consistent and thus does not make sense.
I am guessing that what you are asking is a way to calculate the outgoing angle such that it is only a function of where it hit on the paddle. If it hit the paddle centre, then irrespective of the incoming angle, it will bounce off at an angle of 90 degrees to the paddle. If it hit the paddle edge, then irrespective of the incoming angle it will bounce off at an angle of 45 degrees to the paddle.
If so, then the following should do it (it is not the only way).
Assumption: The paddle shape is a rectangle.
Let L be the length of the paddle.
Let K be a constant such that L / (2 * K) = 1 / sqrt(2).
Let D be the distance from the centre of the paddle (may be + or -).
theta = pi/2 - asin (D / K);
This should give you an angle relative to the paddle.
Hope this helps.