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.

DarkChaos

Weapon Rotation when running or near walls

Recommended Posts

Lets Explain the variables:
 
MoveTo - The position of the rotated gun
RotateTo - The rotation of the rotated gun
Player - Character Controller's GO
Layers - Layer to collide with gun
 
Pros: It uses a coroutine to be 10x times faster than in update while using less cpu at the same time
 
If you use a Character Controller:

Please login or register to see this spoiler.
  • Like 5

Share this post


Link to post
Share on other sites

I have the same system (lerping rotation and position) but I have it on each weapon so each weapon lerps to their own rotation/position.

Share this post


Link to post
Share on other sites

Reserved

Log:

-Added both Character Controller and Capsule Collider support

Edited by DarkChaos

Share this post


Link to post
Share on other sites

Here is the full version which also tilts the weapon according to your movement.

Please login or register to see this spoiler.

Share this post


Link to post
Share on other sites

Can you show me an image of your hierarchy? You need to edit the values of the vectors to fit your needs. I will post some sample vectors soon

Share this post


Link to post
Share on other sites

It is the obstacle method. If you call it, it will return true if something is in front and false if not(acts like a boolean)

Share this post


Link to post
Share on other sites

thank you very much, i didn't use yours because i use C# so i will make a similar (i will credit you ) :P thanks again

Edited by nightbird0

Share this post


Link to post
Share on other sites

It pretty much moves the gun out of the way when getting close to a wall like DLG's game.

Share this post


Link to post
Share on other sites

Please login or register to see this link.

Second Image show an ingame screenshot using this.

Or if you are lazy:

DualElites_Wall.PNG

 

Edit: Something isnt working properly with link so...

Please login or register to see this code.

Copy paste this

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...