UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionWeapons Delay effect Script EmptyWeapons Delay effect Script

more_horiz

Code:

var amount : float = 0.02;
var maxAmount : float = 0.03;
var smooth : float = 3;
private var def : Vector3;
 
function Start (){
    def = transform.localPosition;
}
 
function Update (){
 
        var factorX : float = -Input.GetAxis("Mouse X") * amount;
        var factorY : float = -Input.GetAxis("Mouse Y") * amount;
       
        if (factorX > maxAmount)
        factorX = maxAmount;
       
        if (factorX < -maxAmount)
        factorX = -maxAmount;
       
        if (factorY > maxAmount)
        factorY = maxAmount;
       
        if (factorY < -maxAmount)
        factorY = -maxAmount;
 
 
        var Final : Vector3 = new Vector3(def.x+factorX, def.y+factorY, def.z);
        transform.localPosition = Vector3.Lerp(transform.localPosition, Final, Time.deltaTime * smooth);       
}





just drag it in the wepons!! Wink 


descriptionWeapons Delay effect Script EmptyRe: Weapons Delay effect Script

more_horiz
merci adel moi bouziane from algeria

descriptionWeapons Delay effect Script EmptyRe: Weapons Delay effect Script

more_horiz
Don't be trying to act like you wrote this yourself.
Someone might know where it came from and show you.

descriptionWeapons Delay effect Script EmptyRe: Weapons Delay effect Script

more_horiz
Nubzx wrote:
Don't be trying to act like you wrote this yourself.
Someone might know where it came from and show you.



Whatever, Mr. Hero forums Cop. Mad

descriptionWeapons Delay effect Script EmptyRe: Weapons Delay effect Script

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply