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 /
avatar image
0
Question by Arethas · Jun 28, 2017 at 11:18 PM · collisioncollider2dlayercollision

How do I create a partial 2D sprite collision during trigger?

I have a sprite that is attach to the camera and it is one the mid-ground layer. The player is a 2D sprite with a collider that moves forwards and backwards, and it can collide with objects in its path. The enemy/sprite collider is to trigger and hit or block the path of the player, preventing it from moving or killing it. My problem is that the player is on the foreground and the enemy is visible but not meant to block the path until trigger. I currently stuck on how to implement this. Any help would be great.

Comment
Add comment · Show 3
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 hexagonius · Jun 29, 2017 at 09:36 AM 0
Share

I don't quite understand. The enemy is supposed to block the player when he was triggered? By whom? By the player? If so, why not blocking him in the first place, what's the difference with triggering? Could you explain a bit better?

avatar image Arethas · Jul 01, 2017 at 11:29 PM 0
Share
  1. Background, $$anonymous$$idground, Foreground

  2. $$anonymous$$idground has the enemy sprite idle until a certain trigger occurs

  3. Player is in Foreground moving along like a 2D scroller

  4. When player hits object it activates the trigger

  5. Enemy attacks but only a portion of it is to hit the player or block its path *Would it be possible to make a partial collider or only have a portion of the enemy sprite be the collider?

avatar image hexagonius Arethas · Jul 02, 2017 at 07:00 PM 1
Share

Yes, add one to the enemy and adjust it's dimensions and position on it. Or create a child gameobject, add a Collider to that and position and scale it accordingly

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Mercbaker · Jul 02, 2017 at 12:54 AM

There's no such thing as a "partial" collision, it either collides or doesn't.

What you probably want to do is when the player collides with the enemy you call a function on the player to reduce its speed or reduce some stat over time(start a timer).

Or if the player moves closer to the enemy.position then you track that position data. As the player gets closer to the enemy then you increase the effect based off of the position.

In other words. When the player collides with a trigger, call a function and create a unit of measure that changes > update variables based off of those changes.

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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

103 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

Related Questions

using IsTouchingLayer without collision 0 Answers

Ignore Collision for 2d Collider 2 Answers

Detecting collision of two game objects? 0 Answers

Sometimes my character falls through the ground? 1 Answer

Compound collision! 1 Answer


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