Im working on camera recoil for my game and i found a really nice mathematical formula([Formula][1])simulating recoil in a good way. The problem is that im a scrub and dont understand the code well enought.
Heres my code:
var cameraObject : Transform;
function Recoil()
{
var RecoilForce : float = 1;
var TimePassed : float;
var RecoilTimeSpeed : float = 0.001;
TimePassed = Time.deltaTime * RecoilTimeSpeed;
var RecoilUp : float = 5 * TimePassed * RecoilForce ^(1 - 5 * TimePassed);
var RecoilRotation : Vector3 = Vector3(RecoilUp, 0, 0);
cameraObject.Transform.rotate(RecoilRotation * 1);
}
Im getting the Error: BCE0051: Operator '^' cannot be used with a left hand side of type 'float' and a right hand side of type 'float'.
Thanks in advance hope someone can help me.
[1]: https://www.google.fr/search?aq=f&ix=hcb&q=plot%205x*e%5E(1-5x)%20from%200%20to%201&um=1&hl=sv&biw=950&bih=958&ie=UTF-8&sa=N&tab=iw&ei=7NIfUaJS7vnhBL_5gYgB
↧