• 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 barjed · Feb 19, 2014 at 11:23 AM · rigidbodycollidertriggergridiskinematic

Moving kinematic rigidbody trigger against kinematic rigidbody collider

I have a scene where the player can "build" objects by placing them on a grid. Those buildable objects have BoxColliders and Kinematic Rigidbodies assigned to them.

As the user moves the buildable object (it floats at a certain distance above the ground) around the scene, it has a child gameobject with a BoxCollider and a Kinematic Rigidbody that follows it but it's placed on the ground:

alt text

The idea is that when the buildable object moves over something that has been already built, the box trigger of the child object should fire an event. I am talking about this situation:

alt text

It is not working as intended. The moving kinematic rigidbody trigger does not fire any events, even when the rigidbody kinematic collider is directly inside of it. The trigger is moved through the transform.position. The only explanation I can think of is that the movement is not smooth but it "snaps" to each cell of the grid. As the moving cube is of (1,1,1) size, and the cell is (1,1), the cube always moves by 1 in the given movement direction.

boxcollider.png (51.8 kB)
boxcollider2.png (51.1 kB)
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 mattyman174 · Feb 19, 2014 at 11:33 AM 0
Share

Are you using the correct function to detect if the Trigger is Firing an event. OnCollisionEnter() is different to OnTriggerEnter().

It would be nice to see what code you have written to get an idea of where your at.

avatar image prototype7 · Feb 19, 2014 at 11:39 AM 0
Share

Are using OnTriggerEnter or OnCollisionEnter ? if using OnTriggerEnter does the collider Is Trigger in Inspector View checked ?

avatar image barjed · Feb 19, 2014 at 11:41 AM 0
Share

I am using Play$$anonymous$$aker to keep things simple, that has built in Trigger support. The child GameObject that moves on the ground and follows the floating buildable object has a single FS$$anonymous$$ with a very simple state "Listener" that sends events when the trigger is entered/exited:

alt text

Also this P$$anonymous$$ action uses OnTriggerEnter in it's script code.

playmaker1.png (14.4 kB)

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

20 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

Related Questions

How to get collision point when using onTriggerEnter 4 Answers

Activate physics when animation ends 0 Answers

Objects placed manually collide, but don't if instantiated? 1 Answer

Creating a 68x68 grid of trigger cubes 2 Answers

Trigger via Collider 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges