JU TPS Documentation
  • 🤩Welcome to JU TPS
  • 😄Quick Start
    • How to start a new scene
    • How to create a JU Character / Reskin Default Character / Setup New Characters
      • Ragdoll
      • Damageable Body
      • Physical Damage
      • Body Leaning Setup
      • Taking Damage / Healing
      • Footstep System
      • Resizable Capsule Collider
    • 📦 Addon Installer
  • 🎮Game Development
    • Game Styles
      • Third Person Shooter Style
      • First Person Shooter Style
      • Top Down Style
      • 2.5D Sidescroller Style
      • ⚠️Important Info About Cross-Plataform
    • Controls / Inputs
      • JU Input Manager
      • Input Events
    • How to create a Mobile Game with JU TPS
      • Mobile Inputs
    • How to load scene
      • Scene Controller
    • How to use Cover System
    • How to use inventory and add items
      • Inventory in UI
      • How to switch between items
      • How to align weapon rotation
    • How to create weapons and items
      • Prevent gun clipping through walls
      • Creating Projectiles/Bullets
    • How to use Dual Wielding System
    • How to use Armor/Cloth System
    • How to use Vehicle System
      • Standard Vehicle Configuration
      • How to create a Car Controller
      • How to create a Motorcycle Controller
      • Vehicle Engine Sounds
      • Coding Custom Wheeled Vehicles
      • How to enter and exit from a vehicle
    • How to use Gravity Switching
    • How to use Actions/Skill and Animation Events
      • JU TPS State Machine Behaviours
      • JUTPSActions Lib Scripting Reference
    • Camera State Trigger
    • How to use Enemies AI
    • How to use Vehicles AI
  • ⚙️Tools, Utils and Tutorials
    • General Tutorials
      • How to do Ragdoll Fall with Input Event
      • How to disable FPS Aim Mode / Scope / Iron Sight Aim
    • Auto Scripts
    • Icon Generator Tool
    • Destructible Objects System
      • Fracture Generator Tool
    • Pixel Quality Scaler
    • Camera Shake
    • Slow Motion
    • Gizmo Drawer
  • ▶️Video Tutorials
    • How to use JU TPS
  • 💬Discord Community
  • ❓Support | Help
  • 📍Roadmap
  • 🔃Change Log
  • 📦Official Addons
Powered by GitBook
On this page
  • Prevent Gun Clipping Script
  • Creating a Prevent Gun Clipping Wielding Position Reference
  1. Game Development
  2. How to create weapons and items

Prevent gun clipping through walls

PreviousHow to create weapons and itemsNextCreating Projectiles/Bullets

Last updated 1 year ago

The JU TPS has a system that prevents gun clipping through walls, and it works very simply

Prevent Gun Clipping Script

Parameters
Description

To Up Direction Wielding ID

Ray Distance

Block Gun Fire On Prevent Clipping

Makes it impossible for the character to shoot while preventing the weapon from clipping through walls

Walls Layers

Layers that the Raycast will detect walls

On Prevent

Unity Event that is called when a wall is detected

On Stop Prevent

Unity Event that is called when a wall stops being detected

Creating a Prevent Gun Clipping Wielding Position Reference

The image below shows what a Wielding Position Reference should look like to prevent gun clipping.

You can create adjustments that prevent gun clipping individually per weapon, just create new Wielding Position References and adjust the position, that should be close to the body and pointing in a direction other than forward, and then write the Switch ID in the first parameter of the Prevent Gun Clipping Script

This script uses a additional Wielding Position ID from the to adjust the weapon's position to avoid clipping through walls. This script must be added to each weapon individually.

Basically it is the ID in theCenter that prevents the gun clipping through walls

Distance from to the tip of the gun barrel

🎮
Item Aim Rotation Center
Item Aim Rotation
Item Aim Rotation Center