Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Apr 25, 2018 at 11:51 PM by S_jay1 for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by S_jay1 · Jan 17, 2018 at 02:29 AM · collisionrigidbodycolliders

Why does my player fly through my barrier?

I want to create an invisible barrier that my player will just bump into if it collides into it. I followed this thread to create my barrier https://answers.unity.com/questions/52283/invisible-walls.html. It works pretty well for the most part except for the fact that if I keep bumping into the wall, the player can go right through it. How would I fix this?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Buckslice · Jan 17, 2018 at 02:36 AM 0
Share

The page you linked doesn't work. $$anonymous$$ake sure you aren't editing the transform of the player directly and ins$$anonymous$$d move it by changing the rigidbodys velocity or using the Rigidbody.$$anonymous$$ovePosition function.

2 Replies

  • Sort: 
avatar image
0

Answer by Ginxx009 · Jan 17, 2018 at 02:36 AM

First thing to check if do all your invisible barrier have Colliders on them? Are the Collider's "Is Triggers" box clicked on?

Second thing If you have a Rigidbody and all the proper Colliders and you're not ignoring the collisions via code or anything like that.. Try setting your Rigidbody's Collision Detection to "Continuous".

Discrete Detection: Checks the next frame "Is the collider touching another collider in this frame? If not, move there, if so, we collided"

Continuous Detection: Fires a Raycast in the direction of movement to check the collision before they happen.

And Third is please post your code in the reply section so i can help you with the code . Cause maybe it is your problem

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image S_jay1 · Jan 17, 2018 at 04:02 PM 0
Share

I checked the "Is Trigger" box for the Collider and this caused the player to die when it touched the collider. I set the Collision Detection to Continuous but it doesn't seem like it did anything. This is the code I have for the barrier:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class BarrierController : $$anonymous$$onoBehaviour {

 // Use this for initialization
 void Start () {
     GetComponent<Rigidbody> ().velocity = new Vector3 (0, 0, 7);
 }

}

This is the code for the Collision: using System.Collections; using System.Collections.Generic; using UnityEngine;

public class DestroyContact : $$anonymous$$onoBehaviour {

 PlayerController player$$anonymous$$ovement;
 CameraController camera$$anonymous$$ovement;
 public GameObject player;

// public Camera camera; public ParticleSystem particleSystemPlayer; public Vector3 PosofDeadPlayer;

 void Awake()

 {

     player$$anonymous$$ovement = GetComponent <PlayerController> ();

// camera$$anonymous$$ovement = GetComponent(); }

 void OnTriggerEnter (Collider other)
 {
     if (other.gameObject.tag == "Floor") {
         return;
     }
         
     if (other.gameObject.tag != "Floor") {
         Destroy (gameObject);
         PlayerisDead ();

 
     }

 }



 void PlayerisDead()

 {
         player$$anonymous$$ovement.enabled = false;
     //    camera$$anonymous$$ovement.enabled = false;
         PosofDeadPlayer = player.transform.position;
         particleSystemPlayer.transform.position = PosofDeadPlayer;
         particleSystemPlayer.Play (true);
 }

}

avatar image
0

Answer by huppatzd · Jan 17, 2018 at 03:00 AM

Rigidbody > collision detection > continuous

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

138 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Ragdoll with multiple colliders 0 Answers

Adding components to 3d models 1 Answer

stop objects moving through each other 5 Answers

Connect a collider with a rigidbody ?? 1 Answer

How to make two colliders or rigidbodies stick together upon collision, as if there was a glue on their surfaces? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges