Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: colpolstudios on August 12, 2014, 12:10:36 PM

Title: Aiming help
Post by: colpolstudios on August 12, 2014, 12:10:36 PM
Using playmaker I am raycasting myself from the shooting camera towards the sphere (AIM Target)

Demo:https://dl.dropboxusercontent.com/u/150707256/playmaker%20stealth%20new%20character%20WIP/testing%20only.html

When you hit play the Y hit point is at 2.0, but I am playing aim straight at this point.

The camera in scene view is directly behind the player at a 90% angle facing forwards the ray always goes through the sphere (AIM Target).

The player needs to be aiming up, but within a weighted range 0 -1 ; 1=100% of the animation to be played so this would be straight up in the air.

Is there a way to take the hit point details and convert them so I could use the information and apply it to the weighted range?

Reply: Yes, but it requires some math:

Vector3 A = player between shoulders;
Vector3 B = hitpoint;
Vector3 E = B - A;
Vector3 D = E;
D.y = 0;
float C = Angle(E, D);
float X = Sin(C);
X = (X+1) / 2

X is the weighted range.

Question could someone please help me set this up