- Home /
Camera recoil Help
Im working on camera recoil for my game and i found a really nice mathematical formula(Formula)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.
Comment
You can't use ^ to do power of, you need to use a $$anonymous$$athf
function. I think it's called Pow