Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

OneManArmy

Script for weapon (delay effect)

Recommended Posts


Please login or register to see this quote.

Oh nevermind, got confused with bibbobbib's comment. I think what killerkip meant was there were no trees around so why are birds flying around?

  • Like 1

Share this post


Link to post
Share on other sites

If someone wants a mp version of this which is stopped when the game is paused (cursor is not locked)

 

[spoiler=Script]

 

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 (){
if(networkView.isMine){
if(Screen.lockCursor == true){
 
        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);        
}
 
else{
return;
}
}
}

Share this post


Link to post
Share on other sites
Guest altjen

should we remove the old scripts or just put together??????

Share this post


Link to post
Share on other sites

Hello, I have a problem.. This script only works if i disable my animator.. Anyone knows why? 

 

EDIT:

Found solution!

Edited by Wiebrendh

Share this post


Link to post
Share on other sites

Anyone have any tips on adjusting this.

Having a lot of trouble when I use ADS, my acog scope is all over the place haha.

Seems to not react fast enough.

 

 

EDIT:

Forgot to mention I am not using FPS Kit.

Edited by Nubzx

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...