How can i make a viewmodel collision?

Hello fellas!

I am planning to make a Tactical, Realistic FPS Game, and i am a very new scripter and still learning, What i want to achieve is this clip taken from Deadline [PRE-DEMO]:

External Media

You can see in the video, the viewmodel (or so called “FakeArms”) Actually make contact with the wall and pushes itself back after it touches a collideable wall.

I am using the infamous FE Gun Kit engine for my game, which uses springmodule for viewmodel movement, And my viewmodel clips through the wall when i go near enough, or hit it.

And here is my game:

External Media

Any useful tips, or even a script that would help me achieve my goal will be highly appreciated!
if you want to see a code’s example if you’re planning to help me, Here is the gun engine i am using:

I will be closing this topic if i have achieved my goal, Cheers!

I made a mistake when copying the links to the videos, I apologize, Here’s Deadline’s Example
Deadline Example
Mine:
My game’s Example

I’d say raycasting would be your best bet, raycast infront of the gun and if it hits the ray move the viewmodel back to where it hit.

You could also use BlockRays for more accuracy of the collisions

2 Likes

I haven’t learnt Raycasting yet, But i’ll go watch a tutorial about it, thanks mate.
If i managed to do it, I’m putting your reply as solution.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.