Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by dabo1 · Mar 25, 2015 at 07:01 PM · under

Cube under the First Person Controler

I like to make a script which checks if a cube is under the First Person Controler. How should I try to do this in C# , i`ve tryed it with OnTriggerStay but then the cube must be the trigger so what should i do?

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 Calum1015 · Mar 25, 2015 at 07:08 PM 0
Share

You could try using OnTriggerEnter/OnTriggerExit, other than that I can't really help you because I don't know what you are trying to accomplish. Please be specific.

Edit- Are you trying to see if the character is grounded?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Digital-Phantom · Mar 25, 2015 at 07:08 PM

Add an empty game object to the cube, give this empty object its own collider. Raise the collider slightly so its above the cube and have that as the trigger.

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 Calum1015 · Mar 25, 2015 at 07:10 PM 0
Share

This uses a lot of extra memory so will decrease performance, but still a good idea, thumbs up to you!

avatar image
0

Answer by JigneshKoradiya · Mar 25, 2015 at 07:11 PM

you have to put box collider on leg of your character of FPcontroller and you have to put collider on that box when they collide you will get event,put this script on your FPC player and give your box to name Box

using UnityEngine; using System.Collections;

public class FPCScript: MonoBehaviour {

   void OnCollisionEnter(UnityEngine.Collision hit)
  {
    hitobject = hit.gameObject.tag;
     if(hitobject == "Box")
    {
       Debug.Log("player is on box");
    }
 }

}

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Can stand up beneath a collider 1 Answer

Weight exerted on object 3 Answers

[C#] how do I get the name of the object under the player? 1 Answer

Climbing script - impossible get under the map and turning around 0 Answers

How do i make particles be under the Player? 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