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 /
  • Help Room /
avatar image
1
Question by Warhulk1745 · Jan 02, 2016 at 12:28 AM · sizedetectionenemieskill playerkills

AGARIO Mechanichs

Hello everyone !

I'm stuck with this part of my game.

So if any of you have ever player the game AGARIO you'll know what I'm talking about. But if you haven't played it here is the effect I want to get.

My player is simply a sphere, I have other spheres in the game of different sizes. Right now I have it so that you can eat them and you'll get bigger but the problem is you can eat any size you want. What I want is so you can only eat your size and those lower than you. If the player tries to eat one bigger he/she should die.

So I guess I need a way of detecting if what I'm colliding with is bigger than me or smaller than me. If it's bigger I die, if it's smaller or same size I eat it.

Please guys those who want to help with code, write it in unity Java.

Thanks in advance ! I do like and respond to your comments !

PS: I'm not making a game like AGARIO just a mechanic like it.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ElementalVenom · Jan 02, 2016 at 04:06 AM

Should be fairly simple for you to port this to java but its in c#.

So you would want to do

 if(collider.transform.size<transform.size){
 //Eat him
 }else{
 //He eats you
 }

Comment
Add comment · Show 3 · 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 Warhulk1745 · Jan 04, 2016 at 07:11 PM 0
Share

This code, what function would it be under?

Collision Enter ?

avatar image Warhulk1745 · Jan 04, 2016 at 07:20 PM 0
Share

Further more , what is size ? is this a variable I have to create ? If so what function should I give it ? What will it do ? I'm new to coding so I would appreciate if you are thorough with your explanations. Thanks in advance !

-Yas

avatar image ElementalVenom Warhulk1745 · Aug 09, 2016 at 08:28 PM 0
Share

Im sure you've figured this out by now(Sorry for the late reply) But size is a variable that is included in each transform.

avatar image
0

Answer by Warhulk1745 · Jan 04, 2016 at 08:12 PM

@ElementalVenom

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

38 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

Related Questions

Is there a way to see enemies highlighted through walls? 0 Answers

How to click on a GUILayout.Button that is already created 0 Answers

How do you script Beat Detection? 0 Answers

How to detect with colliders while drawing line by line renderer? 1 Answer

How can I stop the Camera from detecting things behind walls. 0 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