• 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 mcslibin · Jun 02, 2014 at 09:16 PM · collisionpushgrabpull

How to Check Collision When Pushing / Pulling Object in 3D Space

I am currently trying to develop a FPS push/pull (in 3D space) mechanic with the following requirements:

  • Player must "grab" object

  • Player must face object's center to grab it

  • Object should turn with player (stay in front of player while turning - partial orbit)

  • Object can be pushed or pulled

  • Object should move with player

  • Object must account for collisions

  • Object moves freely along X/Z (no grid)

  • Object must be able to fall when pushed off ledges

I've managed to solve for most of these requirements by using a rigidbody with gravity on the object and a kinematic rigidbody on the player. I connect the object to the player with a Configurable Joint to get the desired movement, but collision is still causing me grief.

I'm currently using a "crate" for testing that is 1.5x1.5x1.5, meaning that it's wider than the standard FPS player. When I move the player up against a wall (from the side), the crate starts to "climb" in an attempt to align with the player's Z, especially when the player starts turning towards the wall.

I would like to implement collision in such a way that when the crate can no longer move in a particular direction, neither can the player. Any ideas on how I can do this?

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 mcslibin · Jun 09, 2014 at 04:18 PM 0
Share

Been working on this for days, and still no luck. I've been trying a different approach than the one I initially asked about.

I'm using the limit property of the configurable joint I'm using to allow the object to catch on corners in such a way that when the player leaves a secondary collider on the crate it breaks the joint and the player "drops" the object, not unlike how catching an object on a corner in Portal works.

Having more luck trying this way, but still not there yet because of how allowing for a limit on the XZ keeps the crate from moving with the player.

Any thoughts still more than welcome.

avatar image christoph_r · Jun 09, 2014 at 09:18 PM 0
Share

Ins$$anonymous$$d of a Configurable Joint, would maybe applying Force depending on the distance of the player work? If the player is further away, the force would point towards the player, if the player gets close the force pushes the crate away.

avatar image mcslibin · Jun 11, 2014 at 06:23 PM 0
Share

I've thought about trying to use AddForce, but the issues I run into with that are: 1) I don't know how to adjust the force to accurately match player movement speeds 2) Since the object is supposed to act like it's "grabbed" it needs to always be close to the player until it has been released by the player or by collision that pulls the object away from the player

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

22 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

Related Questions

Character Controller with rigidbody 2 Answers

How to make multiple character controllers push each other? 1 Answer

pulling objects across a collider 0 Answers

Making Colliders/Triggers or Rigidbodies move a Character Controller 5 Answers

Add Relative Force doesn't really working for me 1 Answer

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